Keyword

Check if extra field has value in K2 content mod

  • Andrew Paterson
  • Andrew Paterson's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 10 months ago #133645 by Andrew Paterson
Check if extra field has value in K2 content mod was created by Andrew Paterson
<?php if($params->get('itemReadMore') && $item->fulltext): ?>
                        <a class="moduleItemReadMore" href="<?php echo $item->link; ?>">
                                <?php echo JText::_('K2_READ_MORE'); ?>
                        </a>
                        <?php endif; ?>

In the above code (From the k2 contet module default.php template), the display of the read more link requires there to be full text (" && $item->fulltext)").

I would like to replace this with a statement that checks if a specific extra field has a value (I can do this with k2 cat item overrides, but not sure how to do it with the module template).

Many thanks.

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 10 months ago #133646 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Check if extra field has value in K2 content mod
Hello Andrew.

Instead of $item->fulltext you need to add this:
isset($item->extraFields->EXTRAFIELDALIAS->value)

or
$item->extraFields->EXTRAFIELDALIAS->value != ''

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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

  • Andrew Paterson
  • Andrew Paterson's Avatar Topic Author
  • Offline
  • Junior Member
More
9 years 10 months ago - 9 years 10 months ago #133647 by Andrew Paterson
Replied by Andrew Paterson on topic Re: Check if extra field has value in K2 content mod
Thanks very much, that's working great!

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 10 months ago #133648 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: Check if extra field has value in K2 content mod
You 're welcome Andrew :)

JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

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


Powered by Kunena Forum