Page 1 of 1

Display Recent Entries on external page

Posted: Sun Jul 30, 2006 5:57 am
by spackler
I noticed the code (shown below) in another post that allows the display of the last x number of entries to be shown on a page outside the actual blog's directory. I'd like to do this as well but without the entry text - only the title (with link) and date as it shows up in the recent entries plugin within the blog.

In the post http://www.s9y.org/forums/viewtopic.php ... &highlight

Garvin gave the following code which works great.

Code: Select all

<?php 
chdir('serendipity'); // Or change this to the name of the directory where you installed s9y in! 

# Include the s9y framework 
include 'serendipity_config.inc.php'; 

# Initialize Template logic 
serendipity_smarty_init(); 

# Fetch latest entries 
$entries = serendipity_fetchEntries(); 

# Parses the latest entries 
serendipity_printEntries($entries); 

# Displays the latest entries template 
$serendipity['smarty']->display(serendipity_getTemplateFile('entries.tpl', 'serendipityPath')); 
chdir('..'); 
?> 
but what I'd like to do is only show the entries in the same format as the Recent Entries show up within the blog. Something like

Code: Select all

 $entries=serendipity_printRecentEntries... 


Is this possible? I've tried the javascript one and it works but it is not as elegant looking.

Thanks.

Posted: Mon Jul 31, 2006 1:00 pm
by Allstar
Can you not adjust the XML output for your board in the configuration area and then feed that into a aggregator or layout program at the desired destination :?:

Posted: Mon Jul 31, 2006 1:03 pm
by garvinhicking
Hi!

You can simply copy the "entries.tpl" file to "myentries.tpl" and there remove all references to the $entry.body stuff etc. Then it will look exactly like you want. :)

Best regards,
Garvin

Posted: Tue Aug 01, 2006 10:56 pm
by spackler
I modified entries_summmary.tpl and it worked pretty well.

Code: Select all

{serendipity_hookPlugin hook="entries_header"}


<div class="serendipity_entry">
    <ul>
    {foreach from=$entries item="entries"}
        {foreach from=$entries.entries item="entry"}
            <li><a href="{$entry.link}">{$entry.title}</a>
                <br />{$CONST.ON} {$entry.timestamp|@formatTime:DATE_FORMAT_ENTRY}</li>
        {/foreach}
    {/foreach}
    </ul>
</div>
<div class='serendipity_entryFooter' style="text-align: center">
{serendipity_hookPlugin hook="entries_footer"}</div>
One question - is this going to display all my entries or does it cut them off at the 5 or 6 most recent?

Thanks.

Posted: Wed Aug 02, 2006 9:50 am
by garvinhicking
Hi!

It will display as many entries as you've configured your s9y to show for the startpage (default 15 entries). If you want to show all entries, you need to specify a parameter to the fetchEntries() function in your PHP code. :)

Best regards,
Garvin