Keyword

K2 Power Tip: Randomize Extra Field Output

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
8 years 10 months ago - 8 years 10 months ago #144471 by Joe Campbell
K2 Power Tip: Randomize Extra Field Output was created by Joe Campbell
It's time to bring your Joomla K2 website to the next level - How? By randomizing your extra field output, that's how.

Nobody wants to experience that same thing over & over. Variety is the spice of life - right?
This wise quote holds true for your website. By randomizing your content, you can create a unique experience for your visitors.

Here's the Copy & Paste code to randomize your extra field output:
<?php
$input = array("AAA", "BBB", "CCC");
$rand_keys = array_rand($input, 2);
echo  $this->item->extraFields->$input[$rand_keys[0]]->value;
?>

I am using this to randomize call-to-actions, greetings and thank you messages.

Do you have any cool ideas on how to utilize this tip? If so, please share (because sharing is caring :)
Last edit: 8 years 10 months ago by Joe Campbell.

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


Powered by Kunena Forum