Page 1 of 1

smarty template variable reference

Posted: Sat Jul 15, 2006 8:53 pm
by AzRAeL
Hi, i tried to add a list of links to the latest 5 blogentries in ten index.tpl and used following code:

Code: Select all

{foreach from=$entries item="dategroup"}
	{foreach from=$dategroup.entries item="entry"}
    <div class="serendipity_Entry_Date">
        <h3 class="serendipity_date">{$dategroup.date|@formatTime:DATE_FORMAT_ENTRY}</h3>
        <a href="{$entry.link}">{$entry.title|@default:$entry.body|truncate:40:" ..."}</a> {$CONST.POSTED_BY} <a href="{$entry.link_author}">{$entry.author}</a>
    </div>
  {/foreach}  
{/foreach}

anyways, when i click one of the entries, so that i see its comments, i also only see 1 entry in my list (where i expected 5 entries).

how can i solve this and is there a kind of reference of variables i can use for the smarty templating engine?

thanks in advance

UPDATE: ok i already found the reference ;-) - but i still can't solve the broblem

UPDATE2: i found the "Aktuelle Einträge" plugin - seems to do exactly what i need ;-)
Azzy

Re: smarty template variable reference

Posted: Mon Jul 17, 2006 11:16 am
by garvinhicking
Hi!

Yes, a plugin would solve that. Just to explain why it didn't work:

$entries is the variable that holds the entries rendered on the current page! Since in detail view you only view 1 entry on the current page, $entries also only holds 1 entry.

Plus, when you would browse archives of say May 2005, you would not see your 5 latest entries, but instead the first 5 entries of May 2005. ;)

You would instead need to resort to use {serendipity_fetchPrintEntries}, as descbired in http://www.s9y.org/78.html

Best regards,
Garvin