Re: New SlidingWindowPager Class
| From: | Alan Knowles | Date: | Fri, 15 Nov 2002 00:43:51 +0000 |
| Subject: | Re: New SlidingWindowPager Class | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-10811@lists.php.net to get a copy of this message | ||
Lorenzo Alberton wrote:
14/11/2002 19.41.30<table><tr><td> <img='icon_for_page0.jpg'> {foreach:t.range,key,active}{if:active} </td><td bgcolor="red">{key}{else:} </td><td bgcolor="green"><a href="someurl?page={key}">{key}</a>{end:} {end:} </td> </tr></table> I get a bit anal in my old age in seperating display and code.. - I usually get very annoyed with myself if I put any HTML inside the PHP code :) Regards Alani would assume the simpletemplate/flexy (and posibly smarty) code for it would look something like this. so range would be a associative array... {foreach:t.range,key,active} {if:active}{key}{else:}<a href="someurl?page={key}">{key}</a>{end:} {end:} its so the graphic designer can change the look/feel... - a version with icons and coloured backgrounds..
I wonder why you would do that. The pager is supposed to take care of that already. It doesn't only "page" the data, it also builds the links. Maybe I'm missing the point here... Do you need those values for other purposes than the "1 2 3 ... next>>"? On current page of course <a href></a> is omitted... I'm already using this class with smarty, and what I do is: - build the pager - assign the "1 2 3 ... next>>" string to a variable - use that variable in my template, without any need of the foreach up here. example: // build the pager object $pager = new SlidingWindowPager($options); // then assign links to a smarty variable: $smarty->assign("links", $pager->links); just like that... Sorry, but I'm a little bit confused... Regards, Lorenzo --- [Quipo ISP - Questa E-mail e' stata controllata dal programma Declude Virus] [Quipo ISP - This E-mail was scanned for viruses by Declude Virus]