本文整理汇总了PHP中Mage_Core_Block_Template::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Template::assign方法的具体用法?PHP Mage_Core_Block_Template::assign怎么用?PHP Mage_Core_Block_Template::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Block_Template
的用法示例。
在下文中一共展示了Mage_Core_Block_Template::assign方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testAssign
/**
* @magentoAppIsolation enabled
* @covers Mage_Core_Block_Template::assign
* @covers Mage_Core_Block_Template::setScriptPath
* @covers Mage_Core_Block_Template::fetchView
*/
public function testAssign()
{
Mage::app()->getConfig()->getOptions()->setDesignDir(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files');
$this->_block->assign(array('varOne' => 'value1', 'varTwo' => 'value2'))->setScriptPath(__DIR__ . DIRECTORY_SEPARATOR . '_files');
$template = __DIR__ . DIRECTORY_SEPARATOR . '_files/template_test_assign.phtml';
$this->assertEquals('value1, value2', $this->_block->fetchView($template));
}
示例2: searchConfigAction
public function searchConfigAction()
{
if ($this->getRequest()->isPost()) {
$result['error'] = 0;
$query = $this->getRequest()->getPost('query');
if (!empty($query)) {
$configs = Mage::app()->getConfig()->getNode($query);
$items = array();
Magneto_Debug_Block_Config::xml2array($configs, $items, $query);
$block = new Mage_Core_Block_Template();
//Is this the correct way?
$block->setTemplate('debug/configsearch.phtml');
$block->assign('items', $items);
echo $block->toHtml();
} else {
$result['error'] = 1;
$result['message'] = 'Search query cannot be empty.';
}
}
}
示例3: viewLogAction
/**
* Return last 100 lines of log file
*
* @return string
*/
public function viewLogAction()
{
$file = $this->getRequest()->getParam('file');
if (!empty($file)) {
$result = Mage::helper('debug')->getLastRows(Mage::getBaseDir() . '/var/log/' . $file, 10);
if (!is_array($result)) {
$result = array($result);
}
$block = new Mage_Core_Block_Template();
//Is this the correct way?
$block->setTemplate('debug/logdetails.phtml');
$block->assign('title', 'Log details : ' . $file);
$block->assign('items', $result);
echo $block->toHtml();
}
}