为了查看生成的html源代码中用于调试的模板的路径,我在
app/code/core/Mage/Core/Block/Template.php
/**
* Render block
*
* @return string
*/
public function renderView()
{
$this->setScriptPath(Mage::getBaseDir('design'));
$showDebug = true;
if (!$showDebug) {
$html = $this->fetchView($this->getTemplateFile());
}
else {
$template = $this->getTemplateFile();
$tagName = 'template_'.current(explode('.',end(explode('/',$template))));
$html = '<'.$tagName.'><!-- '.$template.' -->';
$html .= $this->fetchView($template);
$html .= '<!--/ '.$template.' --></'.$tagName.'>';
}
return $html;
}但是现在我在错误日志中看到了如下内容: 2010-12-13T21:55:35+00:00 ERR (3):严格注意:只有变量应该通过245行的/app/code/core/Mage/Core/Block/Template.php中的引用传递
为了避免这个错误,应该如何引用它?
发布于 2010-12-15 23:05:40
我很确定你的问题是这一行
$tagName = 'template_'.current(explode('.',end(explode('/',$template))));end和current方法接受数组变量作为参数,通过引用传递。您正在传递函数调用的结果,这是PHP不喜欢的。假设snippet正在尝试获取一个无扩展名的模板名称,请尝试执行以下操作
$parts = pathinfo($template);
$tagName = $parts['filename']; 发布于 2010-12-15 19:16:09
改为安装Developer Toolbar扩展。或者从Admin打开模板提示。
https://stackoverflow.com/questions/4449102
复制相似问题