2012-04-26 61 views
0

我是社交引擎和Zend框架工作的新手。我想自定義我的應用程序的頁眉和頁腳。我的default.tpl包含以下代碼。社交引擎和Zend框架default.tpl自定義

</head> 
<body id="global_page_<?php echo $request->getModuleName() . '-' . $request->getControllerName() . '-' . $request->getActionName() ?>"> 
<div id="global_header"> 
<?php echo $this->content('header') ?> 
</div> 
<div id='global_wrapper'> 
<div id='global_content'> 
<?php //echo $this->content('global-user', 'before') ?> 
<?php echo $this->layout()->content ?> 
<?php //echo $this->content('global-user', 'after') ?> 
</div> 
</div> 
<div id="global_footer"> 
<?php echo $this->content('footer') ?> 
</div> 
</body> 
</html> 

現在我想在頁腳部分加載一些小部件。任何人可以建議我如何自定義<?php echo $this->content('footer') ?>。腳註文件位於我的應用程序?

在此先感謝。

回答

0

首先添加一個腳本位置到您的視圖,然後在您的佈局文件中使用render()partial(),這取決於您的需要。

即:

在你的控制器:

$this->view->addScriptPath('/partials'); // Put your custom files here 

在你看來:

$this->render('customview.phtml') 

See here獲取更多信息。嘗試使用render()而不是partial(),因爲它的速度更快

+0

感謝您的回覆。在頁腳中,我想使用java腳本添加菜單和社交網絡共享鏈接和Twitter推文。在那裏我可以看到頁腳內容的源代碼。 $ this-> content('footer') – siva565 2012-04-26 16:10:41

+0

你能回答頁腳文件的位置問題嗎?我也想知道這一點,主要是因爲我想要模板的位置在這裏調用'<?php echo $ this-> layout() - > content?>' – 2017-01-16 19:01:47

0

內容(「頁腳」)?在你的代碼調用>視圖助手Content.php

內容頁面調用LoadContent方法,從社會的兩個表收集數據引擎

engine4_core_pages表的值爲2,作爲footer的page_id。基於此page_id(2),將查詢engine4_core_content表,其中將顯示已加載小部件的列表。目前,一個小部件用於顯示內容表中的頁腳是

「core.menu-footer」小部件。這個小部件被加載到模板的頁腳區域(default.tpl)。