我想把我的内容和观点分开(我知道,这是一种反高潮的做法)。我想要的是像gettext这样的东西,我可以在视图中拥有一个键。像Content_Materials_Index_Description,然后使用像echo "@Content_Materials_Index_Description"这样的东西来渲染3-4段内容,我已经存储在一个单独的文件中。
我知道如何在Java/J2EE应用程序甚至是VB.net中做到这一点,并希望得到使用Zend Framework来做到这一点的建议。
解释:
查看:
<div id="wrapper">
<a href="/Home">HomePage</a>
<div id="content"><?echo "@content_materials_index_Description"?></div>
</div>messageResource.ini文件
content_materials_index_Description=Materials for production can be edited here. Click on the name of a material to edit it. The cross sign...发布于 2012-11-16 00:11:34
你可以使用partials,你可以传递一些参数给它来呈现内容,比如Table,List等等。
查看文件
$this->partial('path-to-partial/partial-name.phtml', array(
'var1'=>$myVar1,
'var2' => $myVar2
));部分文件
$this->myVar1;
$this->myVar2;除此之外,您还可以使用View helpers
发布于 2012-11-16 00:42:49
它很简单,
在IndexController.php中
public function indexAction()
{
//here you need to read the values from *.ini file. for ex. with Zend_Config_Ini
$this->view->content_materials_index_Description = 'text for description....';
}在视图index.phtml中
<div><?php echo $this->content_materials_index_Description; ?></div>https://stackoverflow.com/questions/13401536
复制相似问题