RE: Best use of templates to separate dynamic data

From: Date: Wed, 07 Nov 2001 17:34:35 +0000
Subject: RE: Best use of templates to separate dynamic data
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-1842@lists.php.net to get a copy of this message
> Hi, > > Apologies if this appears twice - I've waited 2 hours for it > to show up on > the mailing list, so am reposting. > > I am writing an image gallery at the moment, and need to create > next/previous buttons as/if required. In PHP code, I came up > with the > following: > <snip> > > I can see no easy way of making this template based, but I > would really > like to separate all presentation from my code. Has anyone got any > suggestions? Or is this one of those examples where the aim > of separating > presentation and code doesn't stand up to real world use? Hello, you should have a look at he PEAR Pager class (vulcanonet.com/soft/?=pager) that pages results. Having a navbar in the template after that is easy, here's what i do <td colspan="7">{$DATA.numrows} r&eacute;sultat(s) trouv&eacute;(s) | Page {$DATA.current} sur {$DATA.numpages} | {$DATA.limit} r&eacute;sultats par page <br /> <input type="submit" name="prev_page" onclick="javascript:this.form.from.value={if $DATA.prev != 0}{$DATA.prev}{else}0{/if}" value="<-" class="styledbutton" /> | {section name=pages loop=$PAGES} <input type="submit" name="page" onclick="javascript:this.form.from.value={$PAGES[pages].lien}" value="{$PAGES[pages].texte}" class="styledbutton" /> {/section} | {$DATA.remain} r&eacute;sultats page suivante <input type="submit" name="prev_page" onclick="javascript:this.form.from.value={if $DATA.next != 0}{$DATA.next}{else}0{/if}" value="->" class="styledbutton" /></a></td> Hope this helps Arnaud.

« previous php.smarty.general (#1842) next »