Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-01-02 20:18:33

jmart
Member
Registered: 2008-08-25
Posts: 68

Is there a way to make custom fields hotlinked?

Is there any way to make the custom fields hotlinked?

For example, I put in a url into one of my custom fields but it’s not hyperlinked. Is there a way around this? For now, I think I may just type in the url into the excerpt section, instead. And then I will call it using the <txp:excerpt> tag.

Offline

#2 2009-01-02 20:26:18

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Is there a way to make custom fields hotlinked?

custom field – Escaping (X)HTML output

use escape=''

Last edited by MattD (2009-01-02 20:27:18)


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2009-01-02 20:55:03

jmart
Member
Registered: 2008-08-25
Posts: 68

Re: Is there a way to make custom fields hotlinked?

I should note that I am using the glz_custom_field plugin instead of regular custom_field plugin. But the documentation says the plugin uses the same attributes. However, it still doesn’t work.

So I just tried using a regular custom_field tag with it looking like this; <txp:custom_field name=“fieldname” escape=“html” /> but the url is still not hyperlinked at all. In the actual custom field box, I inputted, http://www.domain.com . I also tried <a href=“http://www.domain.com”> . But nothing works. It only outputs the url with no hyperlink.

Offline

#4 2009-01-02 20:57:51

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Is there a way to make custom fields hotlinked?

It won’t get hyperlinked by itself… I assume you just want to type ‘www.domain.com’ in a custom field? Then in your article form use this:

<a href="http://<txp:custom_field name="name-of-your-custom-field" />"><txp:custom_field name="name-of-your-custom-field" /></a>

Offline

#5 2009-01-02 21:08:20

jmart
Member
Registered: 2008-08-25
Posts: 68

Re: Is there a way to make custom fields hotlinked?

Thanks!

But then what does previous suggestion do?

Offline

#6 2009-01-02 21:18:55

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,453
Website GitHub

Re: Is there a way to make custom fields hotlinked?

jmart wrote:

But then what does previous suggestion do?

Using escape="" prevents the contents of the custom field being converted to its HTML entities and breaking the URL. Not sure how glz_custom_fields handles things though. Sounds like it’s not quite working.

P.S. Sorry MattD, I’ve just updated Textbook because the example assumed that escape="" by default whereas under 4.0.7+ it’s escape="html". The link is now Unescaping (X)HTML output instead.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB