Keyword

How do you apply urlencode to Extra Field alias?

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
10 years 6 months ago #126389 by Joe Campbell
I am able to apply the following urlencode to static text, with the following code...

<?php echo(urlencode('Any Text Here')); ?>

I am also able to display the Extra Field, with the following code...

<?php echo $this->item->extraFields->AliasHere->value; ?>


How do I combine the two, to dynamically apply the urlencode to the Extra Field that I want displayed?

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

More
10 years 6 months ago #126390 by Lefteris
Hi. You can't do this easily. The value holds also the a tag so you need to process it first with a regular expression. The question here is: why you need to do this?

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

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

  • Joe Campbell
  • Joe Campbell's Avatar Topic Author
  • Offline
  • Platinum Member
More
9 years 6 months ago #142021 by Joe Campbell
Replied by Joe Campbell on topic Re: How do you apply urlencode to Extra Field alias?
I need it to pass extra field values to non-javascript social media share links:

danielmiessler.com/blog/social-media-buttons-no-javascript/

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

  • Krikor Boghossian
  • Krikor Boghossian's Avatar
  • Offline
  • Platinum Member
More
9 years 6 months ago #142028 by Krikor Boghossian
Replied by Krikor Boghossian on topic Re: How do you apply urlencode to Extra Field alias?
Wouldn't you need the Absolute URL of the item instead?
$this->item->absoluteURL

Now if you want to combine a text field you can do the following:
<?php echo ( urlencode($this->item->extraFields->AliasHere->value)); ?>

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