本文整理汇总了PHP中Mage_Core_Block_Template::getTemplateFile方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Template::getTemplateFile方法的具体用法?PHP Mage_Core_Block_Template::getTemplateFile怎么用?PHP Mage_Core_Block_Template::getTemplateFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Block_Template
的用法示例。
在下文中一共展示了Mage_Core_Block_Template::getTemplateFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetTemplateFile
/**
* @magentoAppIsolation enabled
*/
public function testGetTemplateFile()
{
Mage::app()->getConfig()->getOptions()->setDesignDir(__DIR__ . DIRECTORY_SEPARATOR . '_files');
// with template
$template = 'dummy.phtml';
$this->_block->setTemplate($template);
$file = $this->_block->getTemplateFile();
$this->assertContains('frontend', $file);
$this->assertStringEndsWith($template, $file);
// change area
$this->_block->setArea('adminhtml');
$file = $this->_block->getTemplateFile();
$this->assertContains('adminhtml', $file);
$this->assertStringEndsWith($template, $file);
}
示例2: getTemplateFile
/**
* Get absolute path to template
*
* Load template from adminhtml/default area flag is_simple is set
*
* @return string
*/
public function getTemplateFile()
{
if (!$this->getIsSimple()) {
return parent::getTemplateFile();
}
//load base template from admin area
$params = array('_relative' => true, '_area' => 'adminhtml', '_package' => 'default');
return Mage::getDesign()->getTemplateFilename($this->getTemplate(), $params);
}
示例3: xmlEncodeAndAddHovers
/**
* convert each string which linking to some class or template to ajax link
*
* @param string $xml
* @return string
*/
public function xmlEncodeAndAddHovers($xml)
{
$xml = preg_replace(['/<template>(.*?)<\\/template>/ium', '/template="(.*?)"/ium', '/helper="(.*?)"/ium', '/(<.+?type=")(.*?)("[^>]*>)/ium'], ['<template>{{template=$1}}</template>', 'template="{{template=$1}}"', 'helper="{{helper=$1}}"', '$1{{block=$2}}$3'], $xml);
$xml = htmlspecialchars($xml);
if (Mage::app()->getStore()->isAdmin()) {
$routeBase = 'debug/admin_index';
} else {
$routeBase = 'debug/index';
}
$pattern = '/{{(.*?)}}/ium';
$xml = preg_replace_callback($pattern, function ($matches) use($routeBase) {
list($key, $val) = explode('=', $matches[1]);
switch ($key) {
case 'block':
$url = Mage::getUrl($routeBase . '/viewBlock', ['block' => Mage::app()->getConfig()->getBlockClassName($val), '_secure' => Mage::app()->getStore()->isCurrentlySecure()]);
$result = '<a class="remoteCall" href="' . $url . '">' . $val . '</a>';
break;
case 'helper':
$url = Mage::getUrl($routeBase . '/viewBlock', ['block' => Mage::app()->getConfig()->getHelperClassName(preg_replace('/\\/[^\\/]*$/', '', $val)), '_secure' => Mage::app()->getStore()->isCurrentlySecure()]);
$result = '<a class="remoteCall" href="' . $url . '">' . $val . '</a>';
break;
case 'template':
$block = new Mage_Core_Block_Template();
$block->setTemplate($val);
$url = Mage::getUrl($routeBase . '/viewTemplate', ['_query' => ['template' => $block->getTemplateFile()], '_secure' => Mage::app()->getStore()->isCurrentlySecure()]);
$result = '<a class="remoteCall" href="' . $url . '">' . $val . '</a>';
break;
}
return $result;
}, $xml);
return $xml;
}