ZenphotoCMS Forum
1 article AND headlines on homepage? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: Plugins (https://forum.zenphoto.org/forum-6.html)
+--- Thread: 1 article AND headlines on homepage? (/thread-4465.html)



1 article AND headlines on homepage? - salmoon - 13-01-2009

Hi.. i can't figure this out and not sure if it's actually possible.

On my index page i'm trying to have just 1 news post (which is truncated with a readmore link..) and then a list of headlines with dates on the right.

I guess i just use the news loop for the headline list - how do i limit that list to say..the 5 most recent?

And then for the news article.. how do i just display the latest one?

Remember this is all on the same page. I tried using 2 news loops and they conflicted.

Thanks for any help!!




1 article AND headlines on homepage? - acrylian - 13-01-2009

Two loops are not possible but for this case there are the getLatestNews()/printLatestNews() functions. That would be the easiest. Please see the documentation for more info.




1 article AND headlines on homepage? - salmoon - 14-01-2009

Thansk Acrylian...

I've looked at the template-functions page and have found getLatestNews().

I don't understand how i impliment it though. I tried this but it just gave me a bunch of syntax errors.




1 article AND headlines on homepage? - salmoon - 14-01-2009

uhh.. nevermind, i understand it now.

However, is there a way to get it to only display news? It seems to be displaying both news and album updates. I figure i could just define a category to keep it to news, but i need multiple news categories so that won't work. Is there a way to define a type of news?

this is my line so far:




1 article AND headlines on homepage? - salmoon - 14-01-2009

sorry i'm an idiot. dunno how i missed that $option string.




1 article AND headlines on homepage? - acrylian - 14-01-2009

Btw you don't need to write ?php printLatestNews($number='1'); ?>but ?php printLatestNews(1); ?>. I suggest taking a look here maybe: http://www.zenphoto.org/2008/04/how-to-read-the-zenphoto-functions-guide/




1 article AND headlines on homepage? - salmoon - 14-01-2009

ok here's something i can't figure out..

Now i've got my line:

How do i style the individual items that make up that post? So like, not have it in a UL... style the link header.. etc.

Is it actually possible without hardcoding it into template-functions.php?




1 article AND headlines on homepage? - acrylian - 14-01-2009

Several possibilites:

  1. There are css classes attached you can style directly.
  2. Use the getLatestNews() to write your own custom output function (basically all functions have a get equivalent for that reason). You will of course need php knowledge to manage that.



1 article AND headlines on homepage? - salmoon - 14-01-2009

so it's not as simple as doing something like this?




1 article AND headlines on homepage? - salmoon - 14-01-2009

this seems to work. is this correct?




1 article AND headlines on homepage? - acrylian - 14-01-2009

Yep, that is the right way. (btw none does not need to be set since it is the default values if nothing is entered. If you enter anything else it should be in quotes)




1 article AND headlines on homepage? - salmoon - 14-01-2009

excellent. thanks so much for the help.