【发布时间】:2010-12-15 10:52:44
【问题描述】:
为了在生成的 html 源代码中查看模板路径以进行调试,我在
中使用了以下代码 sn-papp/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): 严格注意:只有变量应该在 /app/code/core/Mage/Core/Block/Template.php 第 245 行通过引用传递
应该如何引用它以避免这个错误?
【问题讨论】: