Get actual URL in Cakephp without replacing plus (+)

In Cake PHP If URL has plus(+) sign, and get url with $this->params. then + will be raplced with space. SO for getting actual URL just change your .htaccess Go to app/webroot/.htaccess replace RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] to RewriteRule ^(.*)$ index.php?url=$1 [QSA,L,B]Read more …

Extract is your friend

Use of extract function, For example, generally how we use varibles. $name = $_REQUEST[‘name’]; $surname = $_REQUEST[‘surname’]; $message = $_REQUEST[‘message’]; So, instead of defining as above , we can use extract($_REQUEST); Will automatically make $name = $_REQUEST[‘name’]; So, you can say “hello “.$name.” “.$surname.” without doing all the declarations.Read more …
Herry

Cakephp Pagination Issue

When Set Pagination in Cakephp we can use costume url for the pagination path. By default path is : page url   $this->renderElement( ‘cake_pagination’, array( ‘model’ => $model, ‘paging’ => array_merge( $this->params[‘paging’][$model], array( ‘url’ => array(‘controller’ => ‘Pages’, ‘action’ => ‘all_messages_data’), )), ));Read more …
dhavalp

How to find average in cakephp 3

There is a different method to find average of the column in cakephp 3. refere below code to find average of the column. $query = $review->find(); $query->select([‘averagerating’ => $query->func()->avg(‘rating’)]) ->where([‘id’ => $review[‘id’]]) ->order([‘id’ => ‘DESC’]) ->first();Read more …
dhavalp

Install Plugin must need .htaccess file in root folder

For run new installed plugin and any other module we need to add .htaccess file with code mention below is must in root folder, otherthen it cant find the root of plugin and plugin will not found in the website.   <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule...Read more …