PDA

View Full Version : Help with News on Index Page


timned88
17th of November 2007 (Sat), 00:22
Howdy folks,
I have a problem in which <html> tags used in news items are not being read and displayed on the index page but when you click the <more> tag at the end of the item they are properly displayed on the news page. Is there a way to make the html work in the news on the index AND the news page?

www.themagicinpixels.com/photos

jeronimo
17th of November 2007 (Sat), 13:07
I see your problem, but I think the output is just plain text, because it's also output for the RSS feed...

And if you make a list apear on your index page, then your lay out wil be screwed.
E.g. what if you put an photo in your text?

timned88
17th of November 2007 (Sat), 13:10
i think you are right but it also doesn't accept line breaks. can you think of a way around that?

jeronimo
17th of November 2007 (Sat), 13:17
no I don't know about that. But if it does strip other html codes, then it does strip te <br> code etc also

wkitty42
19th of November 2007 (Mon), 19:23
i think you are right but it also doesn't accept line breaks. can you think of a way around that?
what linebreaks? can't you just hit the ENTER key ;)

timned88
19th of November 2007 (Mon), 19:25
it disregards lines breaks via the enter key.. ie. hitting enter twice doesnt add a blank line. bummer.

Pekka
20th of November 2007 (Tue), 15:46
it disregards lines breaks via the enter key.. ie. hitting enter twice doesnt add a blank line. bummer.

You could always add nl2br function around template item, like

<?php print nl2br($_some_text_html); ?>

http://www.php.net/nl2br

timned88
20th of November 2007 (Tue), 17:29
pekka, could you please me a little more specific such as which file to add this to and where? thanks for all the help.

Pekka
21st of November 2007 (Wed), 17:53
Depends on your templates, but normally you would edit /templates/pages/ee_2_default_UDM/index/default_XHTML_content.php

Line

<div class="ee_css_paragraph"><?php print $news_html; ?></div>

to

<div class="ee_css_paragraph"><?php print nl2br($news_html); ?></div>

You can edit templates also in editor (if your ftp server works): SETTINGS -> styles -> (Index Content template) -> [EDIT]

timned88
21st of November 2007 (Wed), 19:01
that did it... thanks, pekka