Page 1 of 2

last article on static page

Posted: Sun Mar 26, 2006 4:11 pm
by smartieskiller
hi i would like to post the last 5 article on static page but i don't know how to do this ??
Someone got an idea ????

thx a lot

Re: last article on static page

Posted: Sun Mar 26, 2006 10:39 pm
by garvinhicking
Hi!

You can use the Smarty {serendipity_fetchPrintEntries} functions provided with Serendipity 1.0 (http://www.s9y.org/78.html) to do that. You can then include this code/markup inside your staticpage template file (plugin_staticpage.tpl ).

Best regards,
Garvin

Posted: Mon Mar 27, 2006 9:45 am
by smartieskiller
hooooooooooooooo great
i'm trying this

thx again :D

Posted: Mon Mar 27, 2006 5:19 pm
by smartieskiller
hi thx oki another trouble

Code: Select all

<!-- Last 5 Articles START -->
  <fieldset class="staticpage_content"><legend class="">Les 5 Derniers Articles</legend>
<div class="staticpage_content">{serendipity_fetchPrintEntries}</div>
   
  </fieldset>
<!-- Last 5 Articles START -->
this is my piece of code for showing all article but i 'd like to limit this to 5 articles but i don't know how too. ?? is there a sql request ????

thx for helping a poor noob on programing.

Posted: Mon Mar 27, 2006 7:09 pm
by garvinhicking
Please read the documentation. I gave you the link in my previous posting.

You then will need something like this:

Code: Select all

<!-- Last 5 Articles START -->
  <fieldset class="staticpage_content"><legend class="">Les 5 Derniers Articles</legend>
<div class="staticpage_content">{serendipity_fetchPrintEntries limit=5}</div>
   
  </fieldset>
<!-- Last 5 Articles START --> 
Best regards,
Garvin

Posted: Mon Mar 27, 2006 8:41 pm
by smartieskiller
i read it but sorry for my bad english learn
thx a lot .i didn't know that we can put an "limit=" to this expression

thx again.

Posted: Mon Mar 27, 2006 10:27 pm
by smartieskiller
GREATTTTTTTTTTT works fine

but there is an little trouble

All my last 5 articles are write in double ????????????

Really strange.

take a look on the index page

http://smartieskiller.free.fr/serendipity/index.php

Posted: Tue Mar 28, 2006 3:57 am
by judebert
Most likely the fetchPrintEntries line has been duplicated in the template, or in a plugin. I'd check your blog to verify, but it seems to be down right now.

Posted: Tue Mar 28, 2006 2:55 pm
by smartieskiller
ARFFFFFFFFFF
My hosting server is busy........ :(

Sorry for this.Try later and thx for your help

Posted: Fri Mar 31, 2006 12:27 am
by smartieskiller
arrff i install the "serendipity_event_smartymarkup" plugin and it work like a charm but u've got always the same trouble

ALL my article are write in double
i'm looking inside .tpl file but see nothing fetchPrintEntries

Someone have an idea or is this a BUG ???? if yes ,lool sorry to find it.

thx a lot for helping me.

Posted: Fri Mar 31, 2006 12:13 pm
by garvinhicking
How does your .tpl currently exactly look like, where you call the fetchprintentries function?

Regards,
Garvin

Posted: Fri Mar 31, 2006 5:58 pm
by smartieskiller
it look like this

Theme: andreas06
File: plugin_staticpage.tpl

Code: Select all

{if $staticpage_articleformat}
<div id="staticpage_{$staticpage_pagetitle|@makeFilename}" class="serendipity_Entry_Date serendipity_staticpage">

<h3 class="serendipity_title">{/if}<a href="#">{$staticpage_headline|@escape}</a></h3>

{if $staticpage_navigation AND $staticpage_shownavi}
    <table border="0" cellpadding="2" cellspacing="2" width="96%" class="staticpage_navigation">
        <tr>
            <td class="staticpage_navigation_left"   style="width: 20%"><a href="{$staticpage_navigation.prev.link}" title="prev">{$staticpage_navigation.prev.name|@escape}</a></td>
            <td class="staticpage_navigation_center" style="width: 60%; text-align: center"><a href="{$staticpage_navigation.top.link}" title="top">{$staticpage_navigation.top.name|@escape}</a></td>
            <td class="staticpage_navigation_right"  style="width: 20%; text-align: right"><a href="{$staticpage_navigation.next.link}" title="next">{$staticpage_navigation.next.name|@escape}</a></td>
        </tr>
    </table>
{/if}

{if $staticpage_articleformat}
    <div class="serendipity_entry">
        <div class="serendipity_entry_body">

{/if}

{if $staticpage_pass AND $staticpage_form_pass != $staticpage_pass}
        <div class="staticpage_password">{$CONST.STATICPAGE_PASSWORD_NOTICE}</div>
        <br /><br />
        <form class="staticpage_password_form" action="{$staticpage_form_url}" method="post">
            <div>
                <input type="password" name="serendipity[pass]" value="" />
                <input type="submit" name="submit" value="{$CONST.GO}" />
             </div>
        </form>
{else}
        <div class="staticpage_precontent">{$staticpage_precontent}</div>
        {if is_array($staticpage_childpages)}
        <ul id="staticpage_childpages">
            {foreach from=$staticpage_childpages item="childpage"}
            <li><a href="{$childpage.permalink|@escape}" title="{$childpage.pagetitle|@escape}">{$childpage.pagetitle|@escape}</a></li>
            {/foreach}
        </ul>
        {/if}
        <div class="staticpage_content">{$staticpage_content}</div>

{/if}

{if $staticpage_articleformat}

        </div>
    </div>

</div>
{/if}
<!-- Last 5 Articles START -->
<fieldset class="staticpage_content">
<legend>Les 5 Derniers Articles</legend>
<div class="staticpage_content">{serendipity_fetchPrintEntries}</div></fieldset>
<!-- Last 5 Articles START -->
{if $staticpage_author}
    <div class="staticpage_author">{$staticpage_author|@escape}</div>
{/if}

    <div class="staticpage_metainfo">
{if $staticpage_lastchange}
    <span class="staticpage_metainfo_lastchange">{$staticpage_lastchange|date_format:"%Y-%m-%d"}</span>
{/if}

{if $staticpage_adminlink AND $staticpage_adminlink.page_user}
    | <a class="staticpage_metainfo_editlink" href="{$staticpage_adminlink.link_edit}">{$staticpage_adminlink.link_name|@escape}</a>
{/if}
    </div>
it's from the original andreas theme.
Did i make Mistake ???
thx for helping me

Posted: Fri Mar 31, 2006 8:42 pm
by garvinhicking
Ah, I spot a problem. The serendipity_fetchPrintEntries function actually executes itself again because of a nested loop.

I needed to fix this in the serendipity include/functions_smarty.inc.php file.

You can download the latest full file, or download a DIFF (if you're familiar with that) from here: http://svn.berlios.de/viewcvs/serendipi ... 9&view=log

Replace the downloaded file with your current one, and then the duplication should vanish.

Best regards,
Garvin

Posted: Sat Apr 01, 2006 1:42 am
by smartieskiller
i replace with the new one and now i'm getting this error

Code: Select all

Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 26685 bytes) in /var/www/sdb/3/1/smartieskiller/serendipity/bundled-libs/Smarty/libs/Smarty_Compiler.class.php on line 249

Posted: Sat Apr 01, 2006 2:52 am
by garvinhicking
Oh, that sounds strange. Does it go away when using the old file again?

Maybe you could clean your templates_c folder and it might change a thing? Does this error only occur on the static page, or on all blog listings?

Regards,
Garvin