phpjoomlak2

How can I split (yes/no) radio buttons from PHP echo?


I'm using the Joomla CMS on my website and I have downloaded the k2 plugin.

There is PHP code that I couldn't understand how to split so that I can style it the way I want.

<?php echo ($this->row->published > 0) ? JText::_('K2_YES') : JText::_('K2_NO'); ?>

I want the "yes" alone and the "no" alone.


Solution

  • Joomla JText class pull text from language file so JText::_('K2_YES') returns a text. Now you may separate or style your returned text as you want.

    <?php
    if($this->row->published > 0){
      echo JText::_('K2_YES');
     //style as u want '<h1>'.JText::_('K2_YES').'</h1>' etc.
    }else{ 
      echo JText::_('K2_NO'); 
    }
    ?>