I am using s9y on one of my sites to allow users to easily post news releases so I am trying to trim down the blog functionality. One of the things I am doing is posting the title/date of our entries to all pages on our site using the code below. I'm wondering if anyone would know how to limit the number that shows in the list?
I have a file in the template directory called myentries.tpl with the following code
<?php
chdir('blog'); // 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('myentries.tpl', 'serendipityPath'));
chdir('..');
?>
Go to your Administration screen and under the Administration -> Configuration -> Appearance and Options menu, change the number of posts you would like to appear on the front page.
As a note. When you limit the entries on the front page that doesn't effect this extra external list - it is listing them all. One thing that I did note is that we have our Entries to display on frontpage set to 10 - but the Recent Entries plugin on the side is stopping at 7 - couldn't I connect that function to external pages?
The Parse error is in your "fetchtest.php" file in line 123, not in the Smarty file at line 123!
What is inside the .php file at that line?
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/
<?php
chdir('blog'); // 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();
serendipity_fetchPrintEntries template="my-entries.tpl" limit=10 noSticky="true"
chdir('..');
?>
You mixed Smarty Code into your PHP file, which is not what it's meant to be. I just see that stm9x9 got you on that way, so just forget it and use this fetchtest.php:
<?php
chdir('blog'); // 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();
$e = serendipity_fetchEntries(null, true, 10, false, false, 'timestamp DESC', '', false, true);
serendipity_printEntries($e);
$serendipity['smarty']->display(serendipity_getTemplateFile('my-entries.tpl', 'serendipityPath'));
chdir('..');
?>
The code you previously had in there is only meant to be containde within .tpl files.
HTH,
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/