Mar*_*ive 6 symlink zend-framework magento
任何人都知道为什么Magento不允许在app/design文件夹之外的模板.phtml文件的符号链接?
如果我在该文件夹中执行符号链接,它可以正常工作,但如果它在外部链接,则不起作用.所以它似乎是一些权限/安全性的东西,但我无法在任何地方找到任何信息.
任何人?
解决方法:感谢艾伦的建议,我发现了一个解决方法 - 因为我只是自己用于本地开发我很开心.如果这有助于其他任何人,我会在这里添加它.所以我在core/Mage/Core/Block/Template.php中插入以下内容,直接在Varien_Profiler :: start($ fileName)行之后;
$storeId = Mage::app()->getStore()->getId();
$theme = Mage::getStoreConfig('design/package/name', $storeId);
Mage::Log($this->_viewDir.DS.$fileName);
$includes = $this->_viewDir.DS.$fileName;
if(strpos($includes, 'frontend/'.$theme )) {
include $this->_viewDir.DS.$fileName;
};
Run Code Online (Sandbox Code Playgroud)
使用IF语句可以阻止任何基本模板加倍,并且只允许自定义主题模板通过.
小智 5
这是由于1.4.2中的变化导致Magento不再允许符号链接的文件夹.如果你看看Template.php
$includeFilePath = realpath($this->_viewDir . DS . $fileName);
if (strpos($includeFilePath, realpath($this->_viewDir)) === 0) {
include $includeFilePath;
} else {
Mage::log('Not valid template file:'.$fileName, Zend_Log::CRIT, null, null, true);
}
Run Code Online (Sandbox Code Playgroud)
如果模板不在"viewDir"下,你会发现它不会加载.
| 归档时间: |
|
| 查看次数: |
7226 次 |
| 最近记录: |