Joomla: Check if component content is empty
We use and love Blank Component to show pages without component but even with no title Blank Component still shows html code. This article describes the method used to fully remove component output.
Blank component at least will output something like:
<div class="blank"> </div>
That’s not an empty page. To achieve this first we did a com_blankpage template override copying the file:
components/com_blankcomponent/views/default/tmpl/default.php
to:
templates/YOURTEMPLATE/html/com_blankcomponent/default/default.php
and comment/remove any output inside the template like:
<?php // no direct access defined('_JEXEC') or die; ?>
Now in your template index.php add this code:
$document = JFactory::getDocument(); $compOutput = $document->getBuffer('component'); if (!empty($compOutput)) { $output = '<jdoc:include type="component" />'; }
That will fully disable component output.
Deja un comentario