{"id":21714,"date":"2014-04-28T16:24:32","date_gmt":"2014-04-28T14:24:32","guid":{"rendered":"https:\/\/mamchenkov.net\/wordpress\/?p=21714"},"modified":"2014-04-28T16:24:32","modified_gmt":"2014-04-28T14:24:32","slug":"searching-cakephp-pages","status":"publish","type":"post","link":"https:\/\/mamchenkov.net\/wordpress\/2014\/04\/28\/searching-cakephp-pages\/","title":{"rendered":"Searching CakePHP pages"},"content":{"rendered":"<!-- google_ad_section_start -->\n<p><a href=\"http:\/\/cakephp.org\/\">CakePHP<\/a> framework comes with the default <a href=\"http:\/\/book.cakephp.org\/2.0\/en\/controllers\/pages-controller.html\">PagesController<\/a> which is an awesome out of the box way to build a website of mostly static pages. \u00a0There is one rather annoying limitation though &#8211; no search option. \u00a0If you need a website of mostly static pages with search functionality, you are out of luck. \u00a0I spent a good chunk of time Googling (searching, eh?) for a solution and even talking to people in #cakephp IRC channel. \u00a0The best alternatives, it turned out are listed in this <a href=\"http:\/\/stackoverflow.com\/a\/13160417\/151647\">StackOverflow answer<\/a>:<\/p>\n<blockquote><p>There is no built in way to search static pages as they are just files on disk.<\/p>\n<p>You have three options<\/p>\n<ul>\n<li>Build a model to hold the data somewhat like a CMS so you can use mysql search.<\/li>\n<li>google search for sites<\/li>\n<li>the more hacky approach of reading the contents of all the pages and using preg_match() or similar on the contents to find matches.<\/li>\n<\/ul>\n<p>The first option is probably the best depending on your use case. The second option is the easiest if its public facing content. The third option is a horrible idea<\/p><\/blockquote>\n<p>Since I need the solution for a public facing website, it looks like I&#8217;m gonna go with <a href=\"https:\/\/www.google.com\/cse\/\">Google Custom Search Engine<\/a> option.<\/p>\n<!-- google_ad_section_end -->\n","protected":false},"excerpt":{"rendered":"<!-- google_ad_section_start -->\n<p>CakePHP framework comes with the default PagesController which is an awesome out of the box way to build a website of mostly static pages. \u00a0There is one rather annoying limitation though &#8211; no search option. \u00a0If you need a website of mostly static pages with search functionality, you are out of luck. \u00a0I spent a &hellip; <a href=\"https:\/\/mamchenkov.net\/wordpress\/2014\/04\/28\/searching-cakephp-pages\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Searching CakePHP pages<\/span><\/a><\/p>\n<!-- google_ad_section_end -->\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"_links_to":"","_links_to_target":""},"categories":[1,18,62,1334],"tags":[1537,2233,38,335,1330],"keyring_services":[],"class_list":["post-21714","post","type-post","status-publish","format-standard","hentry","category-general","category-programming","category-technology","category-web-work","tag-cakephp","tag-google-search","tag-php","tag-search","tag-web-development"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[{"id":14788,"url":"https:\/\/mamchenkov.net\/wordpress\/2011\/04\/23\/disable-and-enable-cakephp-plugins-on-the-fly\/","url_meta":{"origin":21714,"position":0},"title":"Disable and enable CakePHP plugins on the fly","author":"Leonid Mamchenkov","date":"April 23, 2011","format":false,"excerpt":"I am currently working on a rather large project which is based on CakePHP framework. \u00a0In order to simplify the task, I've broken down the whole application into a number of CakePHP plugins. \u00a0Now, however, I want to enable\/disable plugins on the fly. \u00a0After a brief search around I couldn't\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":28376,"url":"https:\/\/mamchenkov.net\/wordpress\/2018\/02\/11\/zeal-vim-offline-cakephp-and-other-documentation\/","url_meta":{"origin":21714,"position":1},"title":"Zeal + Vim = offline CakePHP (and other) documentation","author":"Leonid Mamchenkov","date":"February 11, 2018","format":false,"excerpt":"As any long time Vim user, I'm constantly looking for ways to tweak and improve my text editor configuration, and make me even more efficient.\u00a0 Today, I came across a very handy addition - Zeal\u00a0- an offline documentation browser for developers. (Thanks to this blog post, which also mentions Dash\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/mamchenkov.net\/wordpress\/wp-content\/uploads\/2018\/02\/Zeal-CakePHP-Inflector-500x265.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":27886,"url":"https:\/\/mamchenkov.net\/wordpress\/2017\/08\/31\/cakephp-with-nightwatchjs-on-travis-ci\/","url_meta":{"origin":21714,"position":2},"title":"CakePHP with NightwatchJS on Travis CI","author":"Leonid Mamchenkov","date":"August 31, 2017","format":false,"excerpt":"My colleague Andrey Vystavkin has been setting up a testing environment for our CakePHP projects recently. \u00a0We had one before, of course, using PHPUnit. \u00a0But this time we wanted to add Google Chrome headless browser with some form of JavaScript test suite, so that we could cover functional tests and\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":11210,"url":"https:\/\/mamchenkov.net\/wordpress\/2008\/05\/29\/toolbox-wordpress-cakephp-sugarcrm-rt\/","url_meta":{"origin":21714,"position":3},"title":"Toolbox : WordPress, CakePHP, SugarCRM, RT","author":"Leonid Mamchenkov","date":"May 29, 2008","format":false,"excerpt":"Over the last couple of years I've been working a lot with these four applications - WordPress, CakePHP, SugarCRM, and RT.\u00a0 Each of these is beautiful in its own way.\u00a0 Each of these tools is an Open Source Software. Each of these tools has a large community. Each of these\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":24952,"url":"https:\/\/mamchenkov.net\/wordpress\/2015\/11\/10\/cakephp-3-cheatsheet\/","url_meta":{"origin":21714,"position":4},"title":"CakePHP 3 Cheatsheet","author":"Leonid Mamchenkov","date":"November 10, 2015","format":false,"excerpt":"CakePHP 3 Cheatsheet - a handy collection of code snippets for anyone new to CakePHP 3 framework and all the changes that went into this version.","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":26051,"url":"https:\/\/mamchenkov.net\/wordpress\/2016\/04\/21\/adventure-in-composer-private-repositories\/","url_meta":{"origin":21714,"position":5},"title":"Adventure in composer private repositories","author":"Leonid Mamchenkov","date":"April 21, 2016","format":false,"excerpt":"First of all, I would like to take this opportunity and wish composer a happy birthday and many more years to come. \u00a0It's been five years, and the world of PHP has changed so drastically that not many people remember how it used to be before. I would have completely\u2026","rel":"","context":"In &quot;All&quot;","block_context":{"text":"All","link":"https:\/\/mamchenkov.net\/wordpress\/category\/general\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_sharing_enabled":true,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/21714","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/comments?post=21714"}],"version-history":[{"count":0,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/posts\/21714\/revisions"}],"wp:attachment":[{"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/media?parent=21714"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/categories?post=21714"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/tags?post=21714"},{"taxonomy":"keyring_services","embeddable":true,"href":"https:\/\/mamchenkov.net\/wordpress\/wp-json\/wp\/v2\/keyring_services?post=21714"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}