【问题标题】:Joomla 3 modules in blog.php overrideblog.php 中的 Joomla 3 模块覆盖
【发布时间】:2014-10-10 10:42:59
【问题描述】:

我在我的 joomla 模板中为 blog.php 创建了一个覆盖,我想将一些 joomla 的默认博客模块添加到侧边栏中

我已将代码添加到我的文件中

<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>

但是当我查看源代码时,代码更改为:

&lt;jdoc:include type="modules" name="blogarticles" style="custom"&gt;

它并没有像我预期的那样呈现。即模块不显示。

我错过了什么吗?

  • 模块位置在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

【问题讨论】:

    标签: php joomla joomla3.0 joomla-module


    【解决方案1】:

    试试这个代码:

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

    【讨论】:

    • 谢谢,仍然像上面那样超时。没有此代码,页面呈现良好。
    猜你喜欢
    • 2012-02-01
    • 2011-10-05
    • 1970-01-01
    • 2016-05-10
    • 2014-05-13
    • 2016-04-08
    • 1970-01-01
    • 1970-01-01
    • 2014-02-06
    相关资源
    最近更新 更多