News on Home page - Got it but not formatted

So I'm using the code below to include the latest news on my home page but it's not formatted. I have a couple lists and spaces between my paragraphs but it's displaying all strung together. When I view the news page by itself it's formatted but when included it's not.

<?php

$latest = getLatestNews(1);
foreach($latest as $item) {
$title = htmlspecialchars(get_language_string($item['title']));
$content = strip_tags(get_language_string($item['content']));

echo "<h3>".htmlspecialchars($title)."</h3>\n";
echo "<p>".htmlspecialchars($content)."</p>\n";

}?>

Any idea what I'm missing?
Thanks,
Mike

Comments

  • acrylian Administrator, Developer
    Well, you will of course need to add some CSS styling. Besides, the news page display is not done with getLatestNews but with the next_news loop. Best you read the theming tutorial before proceeding.
  • All the CSS IS there. My whole site is custom and working fine. The zengallery and other zenpage pages are fully integrated and looking great. This is the third custom integrated site I've done - styling is not the problem. As I said when this page is viewed on it's own it's styled just fine. Just when included into the home page is it not styled. Everything else on that page is styled fine as well...
  • acrylian Administrator, Developer
    So what do you mean by "included in the homepage" exactly? You can simply include Zenphoto pages in another page using `include()`... If you want that you either have to use an "ugly" iFrame or try the "Zenphoto as a plugin" way on our user guide.
  • I designed the site then I want to incorporate zenphoto and zenpage into my design. I had everything integrated except for getting a news article on the home page. After searching I found the above code which did what I wanted but there was no formatting.

    I've since changed the way I did it by simply "including" pages.php. I didn't try that at first because I didn't think it would be that easy. lol. It's all done now and looking awesome. All the content is zenpage and the gallery is zenphoto...I'm very happy with the way it worked out.

    Just need to go over the content and re-organize the gallery...

    http://dev.davidsonscollisioncenter.com/
  • Oh and I didn't use an iframe either... :-)
  • I have searched high and low. Is there any documentation on getLatestNews() more than the list of functions page?
  • The getLatestNews gets just the content - if you want to print it with formatting, you may be looking for printLatestNews instead, unless you're making your own function to format the data from getLatestNews.
  • Yes, @blue dragonfly, I was looking to format the output via getLatestNews. I guess what I was asking for is a bit outside of the scope of these forums and I'd need to delve into picking apart the array, etc.
  • acrylian Administrator, Developer
    You could just look at the printLatestNews() as a guide how to do it or adapt it to your wanted output. If you just want pure news articles you can do this with a quite simple forech loop.
Sign In or Register to comment.