I have this piece of code in my template

<?php if ($showLeftColumn) : ?>
    <aside class="sppb-col-md-3 custom-style-left">
        <jdoc:include type="modules" name="left-top" style="xhtml"/>
        <jdoc:include type="modules"name="leftcenter"style="xhtml"/>
        <jdoc:include type="modules"name="leftbottom"style="xhtml"/>
<?php endif; ?>

This code checks if the module position is selected, and based on that I want to change my layout. The problem being the position has te be always loaded in, but I want to make a left column in my website that shows a article at start publish date, wich means that it has to check if there is an article published in that category. And after that have to check if the date is the date at wich it has to be published. Is there a way in Joomla to do this?


  • Can you be more clear in your description of what you want to do?
    – FFrewin
    Dec 4 '17 at 12:00

The below will get you the number of articles in category that has an ID of 1234.

$db = JFactory::getDbo();
$sql = 'SELECT count(`id`) AS numitems FROM #__content WHERE catid='".1234."'";
$numItems = $db->loadResult();

Your condition should then change to:

<?php if ($showLeftColumn && $numItems) : ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.