Re: [SMARTY] Paging
| From: | Richard Watt | Date: | Thu, 12 Dec 2002 13:36:52 +0000 |
| Subject: | Re: [SMARTY] Paging | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6758@lists.php.net to get a copy of this message | ||
In article <php.smarty.general-6756@news.php.net>, m@mindplay.dk says...
> >> I'm not starting an argument, I'm just telling you what I'd do :)
> >
> >i'm not arguing, i'm trying to find the best way of doing this.
> >
> >> If I wanted to expose the number of items per page to the
> >> designer, I would do so specifically, not generally with a
> >> plugin. Of course it all depends on who you're working with etc. :)
> >
Anyway, im not exposing any PHP to the designer other than having a call
to a database function $class->getRows(); and then doing $this->assign()
and then using Smarty sections to build the table. In theory I really
should build the pagination code in a plugin, but it'll have to wait,
because the client is waiting for a demo ;)
As it stands it isnt affecting the page build time much anyway;
With maths :
(0.23246)
(0.22235)
(0.21596)
(0.22260)
Without :
(0.18932)
(0.18849)
(0.18903)
(0.18791)
Noticeable, but since these are admin pages they wont be hit all that
much anyway.
> >and how would the designer choose the number of items per page when
> >designing the template? what about changing other options for the
> >pagination?
>
> By submitting a query for it? i.e. mypage.php?perpage=20, or by
> creating a form with a "perpage" field ... this way, any safety
> and defaults you implement for your arguments, for the end user,
> shield the designer from the mechanics as well ...
>
I have perpage in the config file, so it can be edited sitewide, the
only variable in the URL is the offset to make it more manageable.