我在joomla模板中为blog.php创建了一个覆盖,我想将一些joomla的默认博客模块添加到侧边栏中
我已将代码添加到我的文件
<div class="blogsidebar">
<div class="module">
<jdoc:include type="modules" name="blogarticles" style="custom" />
<p> </p>
</jdoc:include></div>
<div class="module">
<jdoc:include type="modules" name="blogcategories" style="custom" />
<p> </p>
</jdoc:include></div>
</div>
但是当我查看源代码时,代码更改为:
<jdoc:include type="modules" name="blogarticles" style="custom">
它并没有像我期望的那样呈现。即不显示模块。
我错过了什么吗?
感谢
所以..
<div class="blogsidebar">
<div class="module">
<?php
import('joomla.application.module.helper');
$module = &JModuleHelper::getModule('Articles Category','blogarticles');
echo JModuleHelper::renderModule($module);
?>
<p> </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
答案 0 :(得分:1)
试试这段代码:
$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$options = array('style' => 'xhtml');
echo $renderer->render('blogarticles', $options, null);