Paginator
Permalink
I know there is pagination with the search block.
I was wondering how I could add pagination to a page type. Is it possible to have one 2 blocks under a div area (Block area). Then have the 3rd one create a new page (querystring ?page=2) ?
I don't want to actually use the search block but rather use the pagination from it as an example.
Any ideas? Thanks in advance.
I was wondering how I could add pagination to a page type. Is it possible to have one 2 blocks under a div area (Block area). Then have the 3rd one create a new page (querystring ?page=2) ?
I don't want to actually use the search block but rather use the pagination from it as an example.
Any ideas? Thanks in advance.
I don't think this can be done easily. You could "cheat" by creating 2 pages that have identical content but a different set of blocks in the div area, then add a link back and forth between the two pages at the bottom of that div area, so it would look to the user like they're just paginating between the blocks, but actually they're different pages. The obvious drawback to this is that you'd have to be really careful to keep the main page content in sync between the 2 pages if it ever changes.
Otherwise, if you're a somewhat experienced php programmer it might be possible to achieve this with some php code -- I don't know how to do this exactly, but an idea that comes to mind is in your template instead of the usual $area->display($c) call, you retrieve the blocks directly with something like this:
The you would loop through the number of blocks you want on each "page", and output links beneath that to the other "pages" (which are really just the same page but with a new GET argument in the url that you make up for your own purposes here). When the page reloads, you're re-retrieving the list of all blocks in that area but you look at the GET argument in the url to see if it's a different page number, and only display the appropriate blocks (again with pagination links at the bottom). You could also get crazy with javascript/ajax if you don't want the whole page to reload. You'll probably also want some kind of IF statement in there that would show the area normally (with the $area->display($c) call) when in edit mode so that different blocks could be switched in and out by the admin user after it's all set up.
Best of luck!
Otherwise, if you're a somewhat experienced php programmer it might be possible to achieve this with some php code -- I don't know how to do this exactly, but an idea that comes to mind is in your template instead of the usual $area->display($c) call, you retrieve the blocks directly with something like this:
<? $area = new Area('AreaName'); $blocks = $area->getAreaBlocksArray($c); ?>
The you would loop through the number of blocks you want on each "page", and output links beneath that to the other "pages" (which are really just the same page but with a new GET argument in the url that you make up for your own purposes here). When the page reloads, you're re-retrieving the list of all blocks in that area but you look at the GET argument in the url to see if it's a different page number, and only display the appropriate blocks (again with pagination links at the bottom). You could also get crazy with javascript/ajax if you don't want the whole page to reload. You'll probably also want some kind of IF statement in there that would show the area normally (with the $area->display($c) call) when in edit mode so that different blocks could be switched in and out by the admin user after it's all set up.
Best of luck!
so if i add 2 blocks to the page I want the 3rd one to create a new page