1

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"/>
    </aside>
<?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?

Thanks!

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

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."'";
$db->setQuery($sql);
$numItems = $db->loadResult();

Your condition should then change to:

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

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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