How to detect empty element in template

jfquestiaux

Well-Known Member
In a "div-based" list template, I'd like to "skip" empty element(s), that is, not display the label if there is no value for the element - for instance, in the screenshot, not display "Technique(s)" since no technique is chosen.

Is there a Fabrik method I can call in the template to test if the element is empty because it seems that even when there is no value for the element, $this->_row->data->$heading is never empty so this does not work:
Code:
<?php foreach ($this->headings as $heading => $label) {
        if( !empty($this->_row->data->$heading)) {
        $style = empty($this->cellClass[$heading]['style']) ? '' : 'style="'.$this->cellClass[$heading]['style'].'"';?>
        <li class="<?php echo $this->cellClass[$heading]['class']?>" <?php echo $style?>>
            <span class="divlabel"><?php echo $label;?>:</span>
            <span class="divelement"><?php echo @$this->_row->data->$heading;?></span>
        </li>
        <?php }
    }?>
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top