2014-10-10 27 views
0

我在Joomla模板創建了blog.php的一個替代,我想一些Joomla的默認博客模塊添加到側邊欄在blog.php的覆蓋的Joomla 3個模塊

我已經添加代碼到我的文件

<div class="blogsidebar"> 
    <div class="module"> 
     <jdoc:include type="modules" name="blogarticles" style="custom" /> 
     <p>&nbsp;</p> 
    </jdoc:include></div> 
    <div class="module"> 
     <jdoc:include type="modules" name="blogcategories" style="custom" /> 
     <p>&nbsp;</p> 
    </jdoc:include></div> 
</div> 

但是當我查看源代碼被更改爲:

<jdoc:include type="modules" name="blogarticles" style="custom">

,它不是呈現爲我所期望的。即模塊不顯示。

我錯過了什麼?

  • 模塊位置在templateDetails.xml設置在模塊管理器存在
  • 模塊,並發表
  • 模塊分配到模塊位置
  • 確信沒有錯別字在上述任何。

感謝

所以..

<div class="blogsidebar"> 
    <div class="module"> 
     <?php 
     import('joomla.application.module.helper'); 
     $module = &JModuleHelper::getModule('Articles Category','blogarticles'); 
     echo JModuleHelper::renderModule($module); 
     ?> 
     <p>&nbsp;</p> 
    </div>` 

[10-Oct-2014 12:27:42 Europe/London] PHP Fatal error: Call to undefined function import() in templates\mytheme\html\com_content\category\blog.php on line 127

[10-Oct-2014 13:14:04 Europe/London] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 36987836 bytes) in \libraries\joomla\cache\controller\callback.php on line 173

回答

1

試試這個代碼:

$document = &JFactory::getDocument(); 
$renderer = $document->loadRenderer('modules'); 
$options = array('style' => 'xhtml'); 
echo $renderer->render('blogarticles', $options, null); 
+0

謝謝,仍然如上所述超時。沒有此代碼,頁面呈現良好。 – ChelseaStats 2014-10-10 12:49:52