Re: [fw-general] Question about zend pagination
Matt, thanks for posting this link and quote rom documents. I've already read that before i posted in here :) How to use that in my example? Matthew Ratzloff wrote: From the documentation: The following is an example route you might use in an INI configuration file: routes.example.route = articles/:articleName/:page routes.example.defaults.controller = articles routes.example.defaults.action = view routes.example.defaults.page = 1 routes.example.reqs.articleName = \w+ routes.example.reqs.page = \d+ -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20582454.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Question about zend pagination
Your route doesn't have a :page parameter like the example shows. -Matt On Wed, Nov 19, 2008 at 7:39 AM, vladimirn [EMAIL PROTECTED] wrote: Matt, thanks for posting this link and quote rom documents. I've already read that before i posted in here :) How to use that in my example? Matthew Ratzloff wrote: From the documentation: The following is an example route you might use in an INI configuration file: routes.example.route = articles/:articleName/:page routes.example.defaults.controller = articles routes.example.defaults.action = view routes.example.defaults.page = 1 routes.example.reqs.articleName = \w+ routes.example.reqs.page = \d+ -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20582454.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Question about zend pagination
Can anyone help on this please? :) -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20555822.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Question about zend pagination
I would love to, but you have to be a little more specific what is not working? Do you get an expected result without $paginator? Dou you see the expected amount of results on page 1? How does your link look like for the next page? The more information you provide, the better one can help you vladimirn schrieb: Can anyone help on this please? :)
Re: [fw-general] Question about zend pagination
Thank you Daniel, This is my view script: ?php if (count($this-paginator)): ? ?php foreach ($this-paginator as $banner): ? div div style=float:left; padding-left:20px ?php echo $banner['bannerurl'] ? /div /div ?php endforeach; ? ?php endif; ? On the page i am getting expected amount of results. Then in my controller: $db = Zend_Registry::get ( 'db' ); $select = $db-select () -from ( 'banners', array ('bannerurl', 'height', 'width', 'bannersize' ) ) -where ( 'active = ?', 'y' ) -where ('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype) -order ( 'height', 'ASC' ); $paginator = Zend_Paginator::factory($select); // Set parameters for paginator $paginator-setCurrentPageNumber($this-_getParam(page)); $paginator-setItemCountPerPage(3); $paginator-setPageRange(5); $this-view-paginator = $paginator; And i am getting this on the page: Previous | 1 | 2 | Next ( there are 3 pictures, as expected) And finnaly there is a links produced: div class=paginationControl !-- Previous page link -- lt; Previous | !-- Numbered page links -- 1 | /display/2/CL/3 2 | !-- Next page link -- /display/2/CL/3 Next gt; /div Above code for links i am getting via paginator.phtml It looks like: ?php if ($this-pageCount): ? div class=paginationControl !-- Previous page link -- ?php if (isset($this-previous)): ? ?= $this- url(array('page' = $this-previous)); ?lt; Previous | ?php else: ? lt; Previous | ?php endif; ? !-- Numbered page links -- ?php foreach ($this-pagesInRange as $page): ? ?php if ($page != $this-current): ? ?= $this- url(array('page' = $page)); ??= $page; ? | ?php else: ? ?= $page; ? | ?php endif; ? ?php endforeach; ? !-- Next page link -- ?php if (isset($this-next)): ? ?= $this- url(array('page' = $this-next)); ?Next gt; ?php else: ? Next gt; ?php endif; ? /div ?php endif; ? So, finnal thouth :) I am getting number of results as expectede, and i am getting pagination div, as expected, but when i click on Next, or on 2(which is a link) i am not navigated to the next page, same page just reload, and shows same pictures. Also, links( 1,2,Next,Previous) dont change as visited or something if you know what i mean. Thanks a lot, V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20565246.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Question about zend pagination
Do you define a page parameter in your route? -Matt On Tue, Nov 18, 2008 at 10:14 AM, vladimirn [EMAIL PROTECTED] wrote: Thank you Daniel, This is my view script: ?php if (count($this-paginator)): ? ?php foreach ($this-paginator as $banner): ? div div style=float:left; padding-left:20px ?php echo $banner['bannerurl'] ? /div /div ?php endforeach; ? ?php endif; ? On the page i am getting expected amount of results. Then in my controller: $db = Zend_Registry::get ( 'db' ); $select = $db-select () -from ( 'banners', array ('bannerurl', 'height', 'width', 'bannersize' ) ) -where ( 'active = ?', 'y' ) -where ('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype) -order ( 'height', 'ASC' ); $paginator = Zend_Paginator::factory($select); // Set parameters for paginator $paginator-setCurrentPageNumber($this-_getParam(page)); $paginator-setItemCountPerPage(3); $paginator-setPageRange(5); $this-view-paginator = $paginator; And i am getting this on the page: Previous | 1 | 2 | Next ( there are 3 pictures, as expected) And finnaly there is a links produced: div class=paginationControl !-- Previous page link -- lt; Previous | !-- Numbered page links -- 1 | /display/2/CL/3 2 | !-- Next page link -- /display/2/CL/3 Next gt; /div Above code for links i am getting via paginator.phtml It looks like: ?php if ($this-pageCount): ? div class=paginationControl !-- Previous page link -- ?php if (isset($this-previous)): ? ?= $this- url(array('page' = $this-previous)); ?lt; Previous | ?php else: ? lt; Previous | ?php endif; ? !-- Numbered page links -- ?php foreach ($this-pagesInRange as $page): ? ?php if ($page != $this-current): ? ?= $this- url(array('page' = $page)); ??= $page; ? | ?php else: ? ?= $page; ? | ?php endif; ? ?php endforeach; ? !-- Next page link -- ?php if (isset($this-next)): ? ?= $this- url(array('page' = $this-next)); ?Next gt; ?php else: ? Next gt; ?php endif; ? /div ?php endif; ? So, finnal thouth :) I am getting number of results as expectede, and i am getting pagination div, as expected, but when i click on Next, or on 2(which is a link) i am not navigated to the next page, same page just reload, and shows same pictures. Also, links( 1,2,Next,Previous) dont change as visited or something if you know what i mean. Thanks a lot, V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20565246.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Question about zend pagination
In your link to the next or whatever resultpage site: Are you sure that param page is there? Try something like Zend_Debug::dump($this-_request-getParams()) You should see page = something In my paginator template I link to /baseUrl/module/controller/page/2 /baseUrl/module/controller/2 would not work. Another way to debug or to find the failure is to set: $paginator-setCurrentPageNumber(2); Do you see the expected results from page 2? If so, than you definitly do not pass param page with value 2. vladimirn schrieb: Thank you Daniel, This is my view script: ?php if (count($this-paginator)): ? ?php foreach ($this-paginator as $banner): ? div div style=float:left; padding-left:20px ?php echo $banner['bannerurl'] ? /div /div ?php endforeach; ? ?php endif; ? On the page i am getting expected amount of results. Then in my controller: $db = Zend_Registry::get ( 'db' ); $select = $db-select () -from ( 'banners', array ('bannerurl', 'height', 'width', 'bannersize' ) ) -where ( 'active = ?', 'y' ) -where ('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype) -order ( 'height', 'ASC' ); $paginator = Zend_Paginator::factory($select); // Set parameters for paginator $paginator-setCurrentPageNumber($this-_getParam(page)); $paginator-setItemCountPerPage(3); $paginator-setPageRange(5); $this-view-paginator = $paginator; And i am getting this on the page: Previous | 1 | 2 | Next ( there are 3 pictures, as expected) And finnaly there is a links produced: div class=paginationControl !-- Previous page link -- lt; Previous | !-- Numbered page links -- 1 | /display/2/CL/3 2 | !-- Next page link -- /display/2/CL/3 Next gt; /div Above code for links i am getting via paginator.phtml It looks like: ?php if ($this-pageCount): ? div class=paginationControl !-- Previous page link -- ?php if (isset($this-previous)): ? ?= $this- url(array('page' = $this-previous)); ?lt; Previous | ?php else: ? lt; Previous | ?php endif; ? !-- Numbered page links -- ?php foreach ($this-pagesInRange as $page): ? ?php if ($page != $this-current): ? ?= $this- url(array('page' = $page)); ??= $page; ? | ?php else: ? ?= $page; ? | ?php endif; ? ?php endforeach; ? !-- Next page link -- ?php if (isset($this-next)): ? ?= $this- url(array('page' = $this-next)); ?Next gt; ?php else: ? Next gt; ?php endif; ? /div ?php endif; ? So, finnal thouth :) I am getting number of results as expectede, and i am getting pagination div, as expected, but when i click on Next, or on 2(which is a link) i am not navigated to the next page, same page just reload, and shows same pictures. Also, links( 1,2,Next,Previous) dont change as visited or something if you know what i mean. Thanks a lot, V
Re: [fw-general] Question about zend pagination
I have this in my route: $route = new Zend_Controller_Router_Route( 'display/:pid/:wid/:type', array( 'controller' = 'banners', 'action' = 'display' ) ); $router-addRoute('display', $route); Matthew Ratzloff wrote: Do you define a page parameter in your route? -Matt On Tue, Nov 18, 2008 at 10:14 AM, vladimirn [EMAIL PROTECTED] wrote: Thank you Daniel, This is my view script: ?php if (count($this-paginator)): ? ?php foreach ($this-paginator as $banner): ? div div style=float:left; padding-left:20px ?php echo $banner['bannerurl'] ? /div /div ?php endforeach; ? ?php endif; ? On the page i am getting expected amount of results. Then in my controller: $db = Zend_Registry::get ( 'db' ); $select = $db-select () -from ( 'banners', array ('bannerurl', 'height', 'width', 'bannersize' ) ) -where ( 'active = ?', 'y' ) -where ('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype) -order ( 'height', 'ASC' ); $paginator = Zend_Paginator::factory($select); // Set parameters for paginator $paginator-setCurrentPageNumber($this-_getParam(page)); $paginator-setItemCountPerPage(3); $paginator-setPageRange(5); $this-view-paginator = $paginator; And i am getting this on the page: Previous | 1 | 2 | Next ( there are 3 pictures, as expected) And finnaly there is a links produced: div class=paginationControl !-- Previous page link -- lt; Previous | !-- Numbered page links -- 1 | /display/2/CL/3 2 | !-- Next page link -- /display/2/CL/3 Next gt; /div Above code for links i am getting via paginator.phtml It looks like: ?php if ($this-pageCount): ? div class=paginationControl !-- Previous page link -- ?php if (isset($this-previous)): ? ?= $this- url(array('page' = $this-previous)); ?lt; Previous | ?php else: ? lt; Previous | ?php endif; ? !-- Numbered page links -- ?php foreach ($this-pagesInRange as $page): ? ?php if ($page != $this-current): ? ?= $this- url(array('page' = $page)); ??= $page; ? | ?php else: ? ?= $page; ? | ?php endif; ? ?php endforeach; ? !-- Next page link -- ?php if (isset($this-next)): ? ?= $this- url(array('page' = $this-next)); ?Next gt; ?php else: ? Next gt; ?php endif; ? /div ?php endif; ? So, finnal thouth :) I am getting number of results as expectede, and i am getting pagination div, as expected, but when i click on Next, or on 2(which is a link) i am not navigated to the next page, same page just reload, and shows same pictures. Also, links( 1,2,Next,Previous) dont change as visited or something if you know what i mean. Thanks a lot, V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20565246.html Sent from the Zend Framework mailing list archive at Nabble.com. -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20569014.html Sent from the Zend Framework mailing list archive at Nabble.com.
[fw-general] Question about zend pagination
I have a problem with zend pagination. In my controller i have this: $result = $db-fetchAll ( $sql ); $page = $this-_getParam ( 'page', 1 ); $paginator = Zend_Paginator::factory ( $result ); $paginator-setItemCountPerPage ( 2 ); $paginator-setCurrentPageNumber ( $page ); $paginator-setPageRange ( 5 ); Zend_View_Helper_PaginationControl::setDefaultViewPartial ( 'paginator.phtml' ); $this-view-paginator = $paginator; Now in my view file i am getting this: Start | Previous | 1 2 3 | Next | End Page 1 of 3 Page 2 and 3 and Next are links, but when i click on them, my browser reload, but same result is display on the page. Actually i am not getting result for page 2, 3 or next. Same result as for page 1 is displayed. How to fix this? Thanks, V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20543032.html Sent from the Zend Framework mailing list archive at Nabble.com.
[Fwd: [fw-general] Question about zend pagination]
Try not to pass the total $result array. Let paginator execute the query. $paginator = Zend_Paginator::factory($select); $paginator-setItemCountPerPage(10); $paginator-setCurrentPageNumber($page); $paginator-setPageRange(10); $paginator-setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this-view-pages = $paginator-getPages(); This case you only query for the element needing (limit,offset). When linking make certain that you catch the selected like $page = $this-_request-getParam('page') Works fine for me vladimirn schrieb: I have a problem with zend pagination. In my controller i have this: $result = $db-fetchAll ( $sql ); $page = $this-_getParam ( 'page', 1 ); $paginator = Zend_Paginator::factory ( $result ); $paginator-setItemCountPerPage ( 2 ); $paginator-setCurrentPageNumber ( $page ); $paginator-setPageRange ( 5 ); Zend_View_Helper_PaginationControl::setDefaultViewPartial ( 'paginator.phtml' ); $this-view-paginator = $paginator; Now in my view file i am getting this: Start | Previous | 1 2 3 | Next | End Page 1 of 3 Page 2 and 3 and Next are links, but when i click on them, my browser reload, but same result is display on the page. Actually i am not getting result for page 2, 3 or next. Same result as for page 1 is displayed. How to fix this? Thanks, V ---BeginMessage--- I have a problem with zend pagination. In my controller i have this: $result = $db-fetchAll ( $sql ); $page = $this-_getParam ( 'page', 1 ); $paginator = Zend_Paginator::factory ( $result ); $paginator-setItemCountPerPage ( 2 ); $paginator-setCurrentPageNumber ( $page ); $paginator-setPageRange ( 5 ); Zend_View_Helper_PaginationControl::setDefaultViewPartial ( 'paginator.phtml' ); $this-view-paginator = $paginator; Now in my view file i am getting this: Start | Previous | 1 2 3 | Next | End Page 1 of 3 Page 2 and 3 and Next are links, but when i click on them, my browser reload, but same result is display on the page. Actually i am not getting result for page 2, 3 or next. Same result as for page 1 is displayed. How to fix this? Thanks, V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20543032.html Sent from the Zend Framework mailing list archive at Nabble.com. ---End Message---
Re: [fw-general] Question about zend pagination
$paginator = Zend_Paginator::factory($select); $select has to be an instance of Zend_Db_Select Build your query with Zend_Db_Select and it shoud work $select = $this-db-select() -from(array('a' = 'banners '), array('*')) -where('active = ?', 'y') -where('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype ) ; If i am doing this: $sql = select * from banners where active='y' and programid=' . $programid . ' and websiteid = ' . $websiteid . ' and bannertype= ' . $bannertype . '; //$result = $db-fetchAll ( $sql ); $paginator = Zend_Paginator::factory($sql); i am getting an error: Vladimir Nikolic schrieb: Daniel Tangermann wrote: Try not to pass the total $result array. Let paginator execute the query. $paginator = Zend_Paginator::factory($select); $paginator-setItemCountPerPage(10); $paginator-setCurrentPageNumber($page); $paginator-setPageRange(10); $paginator-setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this-view-pages = $paginator-getPages(); This case you only query for the element needing (limit,offset). When linking make certain that you catch the selected like $page = $this-_request-getParam('page') Works fine for me vladimirn schrieb: I have a problem with zend pagination. In my controller i have this: $result = $db-fetchAll ( $sql ); $page = $this-_getParam ( 'page', 1 ); $paginator = Zend_Paginator::factory ( $result ); $paginator-setItemCountPerPage ( 2 ); $paginator-setCurrentPageNumber ( $page ); $paginator-setPageRange ( 5 ); Zend_View_Helper_PaginationControl::setDefaultViewPartial ( 'paginator.phtml' ); $this-view-paginator = $paginator; Now in my view file i am getting this: Start | Previous | 1 2 3 | Next | End Page 1 of 3 Page 2 and 3 and Next are links, but when i click on them, my browser reload, but same result is display on the page. Actually i am not getting result for page 2, 3 or next. Same result as for page 1 is displayed. How to fix this? Thanks, V Hello Daniel, How you build your sql query in this case? If i am doing this: $sql = select * from banners where active='y' and programid=' . $programid . ' and websiteid = ' . $websiteid . ' and bannertype= ' . $bannertype . '; //$result = $db-fetchAll ( $sql ); $paginator = Zend_Paginator::factory($sql); i am getting an error: Error! Application error Exception information: *Message:* No adapter for type string Stack trace: #0 D:\wamp\www\singlescash\application\controllers\BannersController.php(58): Zend_Paginator::factory('select * from b...') #1 D:\wamp\www\singlescash\library\Zend\Controller\Action.php(502): BannersController-displayAction() #2 D:\wamp\www\singlescash\library\Zend\Controller\Dispatcher\Standard.php(293): Zend_Controller_Action-dispatch('displayAction') #3 D:\wamp\www\singlescash\library\Zend\Controller\Front.php(946): Zend_Controller_Dispatcher_Standard-dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #4 D:\wamp\www\singlescash\application\bootstrap.php(168): Zend_Controller_Front-dispatch() #5 D:\wamp\www\singlescash\index.php(2): require_once('D:\wamp\www\sin...') #6 {main} Thanks, V
Re: [fw-general] Question about zend pagination
Thank you for swift replay :) Now i went with this: $page = $this-_request-getParam('page') ; $db = Zend_Registry::get ( 'db' ); $select = $db-select () -from ( 'banners', array ('bannerurl', 'height', 'width', 'bannersize' ) ) -where ( 'active = ?', 'y' ) -where ('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype) -order ( 'height', 'ASC' ); $paginator = Zend_Paginator::factory($select); $paginator-setItemCountPerPage(3); $paginator-setCurrentPageNumber($page); $paginator-setPageRange(3); $paginator-setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this-view-paginator = $paginator; Still cant get proper results. Links are clickable, but not lead to next page. In display.phtml i have: ?php echo $this-paginator ? ?php foreach ( $this-paginator as $banner ) :? div div style=float:left; padding-left:20px ?php echo $banner['bannerurl'] ? /div /div ?php endforeach; ? Any suggestion? Thanks V -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20544008.html Sent from the Zend Framework mailing list archive at Nabble.com.
Re: [fw-general] Question about zend pagination
Can you provide a link? I am not using Zend_View but a smarty solution. When you dump $paginator, do you have the correct results? So only the necessary amount of rows? Are you sure $page is filled? Kinda like: $page = 1; if($this-_getParam('page ')){ $page = $this-_getParam('page '); } I am using it with success: $this-view-pages = $paginator-getPages(); (for the paginator.tpl, like $this-pages-pageCount -pagesInRange and $this-view-results = $paginator (for looping the results) My paginator.tpl looks like this, maybe it can help (remember this is smarty): {if $this-pages-pageCount 1} div class=paginationControl {assign var=url value=$url|rtrim:/} !-- Last page link -- {assign var=first value=$this-pages-first} {assign var=last value=$this-pages-last} {if !$this-pages-pagesInRange[$first]} a href={$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this-pages-first} lt;lt;/a {/if} {if $this-pages-pageCount 6} !-- Previous page link -- {if $this-pages-previous } a href={$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this-pages-previous} lt; Zurück/a | {/if} {/if} !-- Numbered page links -- {foreach from=$this-pages-pagesInRange key=myId item=i} {if $i != $this-pages-current } {assign var=j value=/seite/$i} a href={$url|regex_replace:'/\/seite\/\d+/':''}{$j} {$i}/a {else} strong{$i}/strong {/if} {if $this-pages-last != $i} | {/if} {/foreach} {if $this-pages-pageCount 6} !-- Next page link -- {if $this-pages-next} a href={$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this-pages-next} Weiter gt;/a {/if} {/if} !-- Last page link -- {if !$this-pages-pagesInRange[$last]} a href={$url|regex_replace:'/\/seite\/\d+/':''}/seite/{$this-pages-last} gt;gt;/a {/if} /div {/if} vladimirn schrieb: Thank you for swift replay :) Now i went with this: $page = $this-_request-getParam('page') ; $db = Zend_Registry::get ( 'db' ); $select = $db-select () -from ( 'banners', array ('bannerurl', 'height', 'width', 'bannersize' ) ) -where ( 'active = ?', 'y' ) -where ('programid = ?', $programid) -where('websiteid = ?', $websiteid) -where('bannertype = ?', $bannertype) -order ( 'height', 'ASC' ); $paginator = Zend_Paginator::factory($select); $paginator-setItemCountPerPage(3); $paginator-setCurrentPageNumber($page); $paginator-setPageRange(3); $paginator-setDefaultScrollingStyle('Sliding'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('paginator.phtml'); $this-view-paginator = $paginator; Still cant get proper results. Links are clickable, but not lead to next page. In display.phtml i have: ?php echo $this-paginator ? ?php foreach ( $this-paginator as $banner ) :? div div style=float:left; padding-left:20px ?php echo $banner['bannerurl'] ? /div /div ?php endforeach; ? Any suggestion? Thanks V
Re: [fw-general] Question about zend pagination
i cant provide a link it is on my localhost :( However, i cant get it working.. -- View this message in context: http://www.nabble.com/Question-about-zend-pagination-tp20543032p20547855.html Sent from the Zend Framework mailing list archive at Nabble.com.