Display Recent Entries on external page

Creating and modifying plugins.
Post Reply
spackler
Regular
Posts: 27
Joined: Fri Aug 19, 2005 8:13 pm
Location: Milwaukee
Contact:

Display Recent Entries on external page

Post 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.
Allstar
Regular
Posts: 9
Joined: Fri Jul 14, 2006 8:45 pm
Contact:

Post 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 :?:
"The price of greatness is responsibility."
Sir Winston Churchill
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post 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
# 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/
spackler
Regular
Posts: 27
Joined: Fri Aug 19, 2005 8:13 pm
Location: Milwaukee
Contact:

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

Post 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
# 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/
Post Reply