{"id":271681,"date":"2019-09-22T09:14:35","date_gmt":"2019-09-22T09:14:35","guid":{"rendered":"https:\/\/www.knowband.com\/blog\/?p=271681\/"},"modified":"2019-10-22T18:51:44","modified_gmt":"2019-10-22T09:21:44","slug":"add-get-parameters-pagination-cakephp-version-2-0","status":"publish","type":"post","link":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/","title":{"rendered":"How to add the get parameters in the pagination on CakePHP version 2.0"},"content":{"rendered":"<h2 style=\"text-align: justify;\">Problem Statement<\/h2>\n<p style=\"text-align: justify;\">There is no default functionality to persist the GET parameters while using \u201c<strong>Paginator<\/strong>\u201d helper in CakePHP. As per default functionality of CakePHP paginatior helper, the GET parameters will remove from the URL if you navigate to the next page.\u00a0So in this blog we will learn how to add the GET parameters in the URL of page number in CakePhp version 2.0?<\/p>\n<h2 style=\"text-align: justify;\">Solution<\/h2>\n<p style=\"text-align: justify;\">If you are facing this issue then you need to add a few lines of code in the beforeRender function. This function is defined in the paginator.php file (File Location: cake\\libs\\view\\helpers\\paginator.php). You need to add the following lines shown in the brown color:<\/p>\n<pre class=\"brush: actionscript3; gutter: true\">public function beforeRender($viewFile) {\r\n            $this-&gt;options[&#039;url&#039;] = array_merge($this-&gt;request-&gt;params[&#039;pass&#039;], $this-&gt;request-&gt;params[&#039;named&#039;]);\r\n\/\/Start of code\r\n              if (!empty($this-&gt;request-&gt;query)) {\r\n                       $get_param = $this-&gt;request-&gt;query;\r\n                       unset($get_param[&#039;url&#039;]);\r\n                       $this-&gt;options[&#039;url&#039;][&#039;?&#039;] = $get_param;\r\n                }    \r\n\/\/ End of code\r\n                parent::beforeRender($viewFile);\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Problem Statement There is no default functionality to persist the GET parameters while using \u201cPaginator\u201d helper in CakePHP. As per default functionality of CakePHP paginatior helper, the GET parameters will remove from the URL if you navigate to the next page.\u00a0So in this blog we will learn how to add the GET parameters in the [&hellip;]<\/p>\n","protected":false},"author":19,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_kbui_enabled":"","footnotes":""},"categories":[1111],"tags":[18091,18089,18090],"class_list":["post-271681","post","type-post","status-publish","format-standard","hentry","category-tips","tag-add-code","tag-add-get-parameters","tag-pagination-on-cakephp-version-2-0"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to add the get parameters in the pagination on CakePHP version 2.0<\/title>\n<meta name=\"description\" content=\"Read this blog to understand how to add the get parameters in the pagination on CakePHP version 2.0. Add the provided code for implementation.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to add the get parameters in the pagination on CakePHP version 2.0\" \/>\n<meta property=\"og:description\" content=\"Read this blog to understand how to add the get parameters in the pagination on CakePHP version 2.0. Add the provided code for implementation.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowband Blog | Ecommerce Modules\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Knowband\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-22T09:14:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-22T09:21:44+00:00\" \/>\n<meta name=\"author\" content=\"Shivam Verma\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@KnowbandPlugin\" \/>\n<meta name=\"twitter:site\" content=\"@KnowbandPlugin\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Shivam Verma\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/add-get-parameters-pagination-cakephp-version-2-0\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/add-get-parameters-pagination-cakephp-version-2-0\\\/\"},\"author\":{\"name\":\"Shivam Verma\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/person\\\/e053c57d62fceb4295302b9293e371f6\"},\"headline\":\"How to add the get parameters in the pagination on CakePHP version 2.0\",\"datePublished\":\"2019-09-22T09:14:35+00:00\",\"dateModified\":\"2019-10-22T09:21:44+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/add-get-parameters-pagination-cakephp-version-2-0\\\/\"},\"wordCount\":125,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\"},\"keywords\":[\"add code\",\"add get parameters\",\"pagination on CakePHP version 2.0\"],\"articleSection\":[\"Tips\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/add-get-parameters-pagination-cakephp-version-2-0\\\/\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/add-get-parameters-pagination-cakephp-version-2-0\\\/\",\"name\":\"How to add the get parameters in the pagination on CakePHP version 2.0\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#website\"},\"datePublished\":\"2019-09-22T09:14:35+00:00\",\"dateModified\":\"2019-10-22T09:21:44+00:00\",\"description\":\"Read this blog to understand how to add the get parameters in the pagination on CakePHP version 2.0. Add the provided code for implementation.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/add-get-parameters-pagination-cakephp-version-2-0\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/add-get-parameters-pagination-cakephp-version-2-0\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/tips\\\/add-get-parameters-pagination-cakephp-version-2-0\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to add the get parameters in the pagination on CakePHP version 2.0\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#website\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\",\"name\":\"Knowband Blog | Ecommerce Modules\",\"description\":\"Magento, Prestashop, Opencart, Shopify\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#organization\",\"name\":\"Knowband Blog | Ecommerce Modules\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/cropped-knowband_logo-v2.png\",\"contentUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/09\\\/cropped-knowband_logo-v2.png\",\"width\":153,\"height\":61,\"caption\":\"Knowband Blog | Ecommerce Modules\"},\"image\":{\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/Knowband\",\"https:\\\/\\\/x.com\\\/KnowbandPlugin\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/fr\\\/#\\\/schema\\\/person\\\/e053c57d62fceb4295302b9293e371f6\",\"name\":\"Shivam Verma\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/Image_for_blogShivam-150x150.jpg\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/Image_for_blogShivam-150x150.jpg\",\"contentUrl\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/02\\\/Image_for_blogShivam-150x150.jpg\",\"caption\":\"Shivam Verma\"},\"description\":\"Shivam Verma is an experienced software engineer in PHP development and Database design. His area of interest is website development. He likes to be aware of his surroundings and to learn new things by observing others. He believes that by doing this we can learn new things and can also enhance our knowledge everyday. He has started writing technical blogs with a view to help others in studying and learning new things in an easy way.\",\"url\":\"https:\\\/\\\/www.knowband.com\\\/blog\\\/author\\\/sverma\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to add the get parameters in the pagination on CakePHP version 2.0","description":"Read this blog to understand how to add the get parameters in the pagination on CakePHP version 2.0. Add the provided code for implementation.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/","og_locale":"en_US","og_type":"article","og_title":"How to add the get parameters in the pagination on CakePHP version 2.0","og_description":"Read this blog to understand how to add the get parameters in the pagination on CakePHP version 2.0. Add the provided code for implementation.","og_url":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/","og_site_name":"Knowband Blog | Ecommerce Modules","article_publisher":"https:\/\/www.facebook.com\/Knowband","article_published_time":"2019-09-22T09:14:35+00:00","article_modified_time":"2019-10-22T09:21:44+00:00","author":"Shivam Verma","twitter_card":"summary_large_image","twitter_creator":"@KnowbandPlugin","twitter_site":"@KnowbandPlugin","twitter_misc":{"Written by":"Shivam Verma","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/#article","isPartOf":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/"},"author":{"name":"Shivam Verma","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/person\/e053c57d62fceb4295302b9293e371f6"},"headline":"How to add the get parameters in the pagination on CakePHP version 2.0","datePublished":"2019-09-22T09:14:35+00:00","dateModified":"2019-10-22T09:21:44+00:00","mainEntityOfPage":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/"},"wordCount":125,"commentCount":0,"publisher":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization"},"keywords":["add code","add get parameters","pagination on CakePHP version 2.0"],"articleSection":["Tips"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/","url":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/","name":"How to add the get parameters in the pagination on CakePHP version 2.0","isPartOf":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#website"},"datePublished":"2019-09-22T09:14:35+00:00","dateModified":"2019-10-22T09:21:44+00:00","description":"Read this blog to understand how to add the get parameters in the pagination on CakePHP version 2.0. Add the provided code for implementation.","breadcrumb":{"@id":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.knowband.com\/blog\/tips\/add-get-parameters-pagination-cakephp-version-2-0\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.knowband.com\/blog\/fr\/"},{"@type":"ListItem","position":2,"name":"How to add the get parameters in the pagination on CakePHP version 2.0"}]},{"@type":"WebSite","@id":"https:\/\/www.knowband.com\/blog\/fr\/#website","url":"https:\/\/www.knowband.com\/blog\/fr\/","name":"Knowband Blog | Ecommerce Modules","description":"Magento, Prestashop, Opencart, Shopify","publisher":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.knowband.com\/blog\/fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.knowband.com\/blog\/fr\/#organization","name":"Knowband Blog | Ecommerce Modules","url":"https:\/\/www.knowband.com\/blog\/fr\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/logo\/image\/","url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2016\/09\/cropped-knowband_logo-v2.png","contentUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2016\/09\/cropped-knowband_logo-v2.png","width":153,"height":61,"caption":"Knowband Blog | Ecommerce Modules"},"image":{"@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Knowband","https:\/\/x.com\/KnowbandPlugin"]},{"@type":"Person","@id":"https:\/\/www.knowband.com\/blog\/fr\/#\/schema\/person\/e053c57d62fceb4295302b9293e371f6","name":"Shivam Verma","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/02\/Image_for_blogShivam-150x150.jpg","url":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/02\/Image_for_blogShivam-150x150.jpg","contentUrl":"https:\/\/www.knowband.com\/blog\/wp-content\/uploads\/2019\/02\/Image_for_blogShivam-150x150.jpg","caption":"Shivam Verma"},"description":"Shivam Verma is an experienced software engineer in PHP development and Database design. His area of interest is website development. He likes to be aware of his surroundings and to learn new things by observing others. He believes that by doing this we can learn new things and can also enhance our knowledge everyday. He has started writing technical blogs with a view to help others in studying and learning new things in an easy way.","url":"https:\/\/www.knowband.com\/blog\/author\/sverma\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/271681","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/comments?post=271681"}],"version-history":[{"count":3,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/271681\/revisions"}],"predecessor-version":[{"id":271705,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/posts\/271681\/revisions\/271705"}],"wp:attachment":[{"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/media?parent=271681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/categories?post=271681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.knowband.com\/blog\/wp-json\/wp\/v2\/tags?post=271681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}