Start page: only most recent entry from each category.

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Don Chambers
Regular
Posts: 3659
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Start page: only most recent entry from each category.

Post 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????
=Don=
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

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

Post by garvinhicking »

Hi!

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

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Don Chambers
Regular
Posts: 3659
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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.
=Don=
Don Chambers
Regular
Posts: 3659
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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?
=Don=
Don Chambers
Regular
Posts: 3659
Joined: Mon Feb 13, 2006 2:40 am
Location: Chicago, IL, USA
Contact:

Post 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.
=Don=
Post Reply