External Link in CB view

  • marszh
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 13
  • Thank you received: 0

marszh created the topic: External Link in CB view


I tried to generate an external link from a CB input field in a CB view. In the article template I used the code:
{hide-if-empty myfield}For more Info visit: <a href="{myfield:value}">Link</a>{/hide}
However, the outcome is not what I was looking for. When the input url in the textfield is something like www.google.com , in CB view this generates a link, but only with the address
instead of something like www.google.com

I can display the url as normal text in the CB view if there is no <a...></a> wrapping it, but of course there is no link then. When using the wrapping, the value from the input field is ignored and the code {myfield:value} is displayed instead. Is there a plugin I might need or what can I do?

Thanks a lot in advance!
btw I have seen a similar topic in this forum, but with no solution working for me and some problems posting a reply there, so I started this new topic.
  • Posts: 43
  • Thank you received: 1

Dragonrider replied the topic: External Link in CB view

From what I've found/been told, you need to define this in the Content Prepare tab so it is set before you try to display it in the Content Template tab.

In content prepare tab:- add the following code:-

$items["Website"]["value"] = "<a href=\"".$url."\" target=\"_blank\">".$items["Website"]["value"]."</a>";

Where Website is whatever name for your field that gets the URL entered.

Then in the Content Template tab, use the following code:

{hide-if-empty Website} <strong>{Website:label}</strong>

Again, change Website for whatever you've called your field that requests the URL.

The _blank ensures that the URL/Website is opened in a new window, retaining your visitor on your site as well.

Hope this helps.
Moderators: ForumSupporttomeperica
Time to create page: 0.058 seconds

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans & templates!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here