Keyword

Extra field radio button if/else statement

  • shannon briggs
  • shannon briggs's Avatar Topic Author
  • Offline
  • New Member
More
3 months 1 week ago #174920 by shannon briggs
shannon briggs created the topic: Extra field radio button if/else statement
I'm trying to use an extra field radio button as a switch, but it's just not working correctly for me - always outputting the value "is on" no matter what is selected.

Here's my code:

<?php
$switch = ($this->item->extraFields->switch->value);
if ($switch = ('on')) { ?>
is on
<?php } else { ?>
is off
<?php } ?>

Please Log in or Create an account to join the conversation.

  • Fotis
  • Fotis's Avatar
  • Away
  • Administrator
  • JoomlaWorks Support Team
More
3 months 5 days ago #174924 by Fotis
Fotis replied the topic: Extra field radio button if/else statement
URL to a page with that value displayed?

The surrounding parentheses to 'on' should be removed by the way. Same for those that wrap the $this->... variable.

If you use & love K2, please take a moment to add your review and rate it
at the Joomla Extensions Directory: extensions.joomla.org/extension/k2/


IMPORTANT: Please search the forum before posting a question!

JoomlaWorks Support Team Member

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum