我有问题。在layout.phtml中,我加载了除少数几个页面外我需要的javascript文件:
$ this-> headScript() - > prependFile($ this-> basePath(' js.js'),' text / javascript');
echo $ this-> headScript()
如何在使用layout.phtml的index.phtml文件中排除此javascript?
答案 0 :(得分:0)
你可以这样做:
if (__FILE__ != $YOUR_PATH_NAME) {
$this->headScript()->prependFile($this->basePath('js.js'), 'text/javascript');
echo $this->headScript()
}
将$YOUR_PATH_NAME
替换为实际路径。如果块不在索引页上