Page 1 of 1
entries.tpl - ouput element only on first entry?
Posted: Tue Mar 27, 2007 1:35 pm
by Dawn
Hi,
I just wanted to know if anybody here know how can I ouput en element for the blog (like a custom string, an ad or something else) only on the first blog entry?
Example:
-----------
bla
Entry 1
-----------
-----------
Entry 2
-----------
-----------
Entry 3
-----------
I know I've to edit entries.tpl for that purpose, but I couldn't find out how can I display it only for the first (or for example for the first 3 entries). Is there a way how I can do that? Is there an abstract about entry.[property]?
Help would be nice...
Greets and best regards,
Dawn
Re: entries.tpl - ouput element only on first entry?
Posted: Wed Mar 28, 2007 3:55 pm
by garvinhicking
Hi!
As you found out, you can edit the entries.tpl template, but you would need to check specific $smarty.foreach.XXX variable to check if the current loop index is "1" or not. This forums holds at least 2 threads I think where this is discussed, maybe you can search for "smarty foreach first" or something like that.
The other way would be to use the plugin "Include/Show entry blocks" where you can define specific ad-blocks or something else to show up every Xth entry in your blog.
Best regards,
Garvin
Posted: Wed Mar 28, 2007 6:53 pm
by judebert
I like using
{counter} for this. Use its "assign" attribute and an {if} statement for checking.
Posted: Thu Mar 29, 2007 11:17 am
by Dawn
Hi Garvin and Judebert,
Thanks for your answers. I decided to take Judeberts solution for my "problem". For others which are searching for a solution, here some sample code:
On the firstline (or in any cache before the foreach of entries.tpl) I've added the following code:
Code: Select all
{counter print=false assign=entry_counter}
Then on the place I want my custom output depending on the entry-number I've added this code:
Code: Select all
{if $entry_counter == 1}
hello world<br>
{/if}
{counter}
Now I've got a last wish: Which file and where in it do I have to edit to display custom output AFTER the output of the plugin(s) (in my case for example the serendipity_event_findmore plugin).
Greets and best regards,
Dawn
Posted: Thu Mar 29, 2007 11:49 am
by garvinhicking
Hi Dawn!
Great you got that to work!
Now I've got a last wish: Which file and where in it do I have to edit to display custom output AFTER the output of the plugin(s) (in my case for example the serendipity_event_findmore plugin).
Look in the entries.tpl file for "{$entry.add_footer}", that holds stuff added by event plugins.
HTH,
Garvin
Posted: Fri Mar 30, 2007 10:20 am
by Dawn
Hi Garvin,
Thanks for your answer

I tried to edit entires.tpl after "{$entry.add_footer}" as you described it. It's true that there are some plugins loaded like Tags an so on.. But do you know if the plugin serendipity_event_findmore is loaded at a special place?
For example if I edit entries.tpl right after "{$entry.add_footer}" it ouputs my custom output in the box on my blog. But serendipity_event_findmore is loaded at the end of the entry (and non extended entry). Do you have an idea what I can do? If you don't know what I mean take a look at
http://blog.blankster.info.
Greets and best regards,
Dawn
Posted: Fri Mar 30, 2007 11:39 am
by garvinhicking
Hi!
Ah, I'm sorry. In fact the social bookmarks plugin uses {$entry.plugin_display_dat} to store its output into.
In cases like this it helps for you to simple add stuff like "<!--test1-->" into the various places in entries.tpl to see where this is placed in the output HTML.
HTH,
Garvin
Posted: Fri Mar 30, 2007 1:59 pm
by Dawn
Thanks for your help garmin, that worked. And thanks for the hint... I've allready tried to test where there right place is (I've found "{$entry.add_footer}" during my tests too) but I couldn't find it and tought perhaps anybody here knowswhere the right place is.
Greets and a very nice weekend,
Dawn