I'm trying to write an if statement to put into a CakePhp template.
Basically I want to print a piece of code on all pages except 1. This page is generated when the controller is "user" and the function "page" in that controller is executed.
This is what I have so far:
<?php
echo $this->Html->meta('icon');
echo $this->Html->script(array('jqueryTouchSwipe.min', 'custom'));
if($this->params['controller'] != 'users'){
echo $this->Html->script('jquery.onp.sociallocker.1.7.6.min');
echo $this->Html->script('box');
}
echo $this->fetch('meta');
echo $this->fetch('script');
?>
However, this only accounts for the controller not being users but does not account for the function.
Any ideas?
You should be able to use $this->params['action']
like:-
if ($this->params['controller'] !== 'users' && $this->params['action'] !== 'page') {
echo $this->Html->script('jquery.onp.sociallocker.1.7.6.min');
echo $this->Html->script('box');
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.