0

I have created an override for blog.php in my joomla template and I want to add some of joomla's default blog modules into a sidebar

I've added the code to my file

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

but when i view source the code is changed to :

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

and it's not rendered as i would expect. i.e the module is not displayed.

Am i missing something?

  • module position is set in templateDetails.xml
  • module exists in module manager and is published
  • module is assigned to module position
  • made sure there were no typos in any of the above.

thanks

so..

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

1

Try this code:

$document = &JFactory::getDocument();
$renderer = $document->loadRenderer('modules');
$options = array('style' => 'xhtml');
echo $renderer->render('blogarticles', $options, null);
stckvrw
  • 1,689
  • 18
  • 42
  • thanks, still getting the time out as above. page renders fine without this code. –  Oct 10 '14 at 12:49