Page 1 of 1

Start page: only most recent entry from each category.

Posted: Mon Nov 26, 2007 5:07 am
by Don Chambers
I need a method to display each of the most recent entries, for each category, on a start page, ideally followed by additional "recent posts". The Hemmingway Port performs some of the functionality that I want, but I am having difficulty understanding exactly what the alternative entries.tpl files are actually doing in that theme/template (no offense intended Carl - I just cannot seem to grasp what is going on).

Ideally, here is what I want:

{if $currpage==$serendipityBaseURL} (Current page is now the base/start/front page)

Display the most recent entry for each catetory (alternatively, the X most recent entries regardless of category) followed by a list of recent entries, possibly limited to a specific count.

Ideas????

Re: Start page: only most recent entry from each category.

Posted: Mon Nov 26, 2007 11:44 am
by garvinhicking
Hi!

Check the smarty "serendipity_fetchPrintEntries" function, it'S documented in the technical docs on www.s9y.org.

Regards,
Garvin

Posted: Mon Nov 26, 2007 4:53 pm
by Don Chambers
Yes - I have been trying to digest "serendipity_fetchPrintEntries". It is here: http://www.s9y.org/78.html

That page is difficult to read due to the page width, and the lack of styling in css for pre and/or .code. Perhaps overflow: auto?

Also noticed that the site's index.tpl is trying to load the 2 stylesheets twice.

Posted: Mon Nov 26, 2007 5:41 pm
by Don Chambers
I suspect what I am going to ultimately want is a unique entries.tpl for only the front page. So, in index.tpl, I have this:

Code: Select all

{if $currpage==$serendipityBaseURL}
    {include file="entries_home.tpl"}
{else} 
    {$CONTENT}
{/if}
Next, I am trying to grasp what Carl did in the hemmingway template. He also uses a unique entries.tpl for the start page, in which is this:

Code: Select all

{foreach name="loop1" from=$entries item="dategroup"}
{foreach name="loop2" from=$dategroup.entries item="entry"}
{if $smarty.foreach.loop1.index==0 && $smarty.foreach.loop2.index==0}
What is the purpose of the second foreach loop, and what is the {if} accomplishing? First iteration of both loops?

EDIT: This template shows the first entry in full, followed by just the permalinks of remaining items. I like the concept, but would want to show the entries in full for the first 6, followed by the remaining as links. How do the loops get structured for that?

Posted: Mon Nov 26, 2007 7:29 pm
by Don Chambers
OK - I understand it now! :lol: I think I was a bit thrown off by the 2 foreach loops to detect just the first entry.