Posts

Showing posts from October, 2017

Using components in Cakephp 3+

Image
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 <?php namespace App\Shell ; use Cake\Console\Shell ; use Cake\Controller\Component ; use Cake\Controller\ComponentRegistry ; use App\Controller\Component\YourComponent ; class YourShell extends Shell { public function initialize () { parent :: initialize (); $this -> Your = new YourComponent ( new ComponentRegistry ()); } public function yourMethod () { $this -> Your -> component_method ($params1); } } ?>

Creating robot.txt for CakePHP

Image
What is robots.txt? Robots.txt is a text file webmasters create to instruct web robots (typically search engine robots) how to crawl pages on their website.  To learn more and see examples of robots.txt :  https://moz.com/learn/seo/robotstxt Cakephp - MissingControllerException Controller class Robots.txt Create the robots.txt in  your  webroot/   directory.

CakePHP Change Default Timezone Set

Set timezone in App/Config/bootstrap.php (Cakephp 2.6+) Set timezone in config/bootstrap.php (Cakephp 3) 1 2 3 4 5 6 7 8 <?php /* * Set server timezone to UTC. You can change it to another timezone of your * choice but using UTC makes time calculations / conversions easier. * Check http://php.net/manual/en/timezones.php for list of valid timezone strings. */ date_default_timezone_set( 'Asia/Manila' ); ?> Check http://php.net/manual/en/timezones.php for list of valid timezone strings.