Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-09-11 21:41:42

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

having urls in custom fields

I entered the following in my custom field:

"This is a link":http://www.textism.com

but it does not get rendered as a link, it’s ouput as seen here


…. texted postive

Online

#2 2009-09-11 22:07:01

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: having urls in custom fields

Textile in custom fields is not parsed.
You can try upm_textile.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2009-09-11 22:17:48

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

Re: having urls in custom fields

Thank you.

I installed the plugin and tried again.. no better. Do I need to add code in the forms/pages?


…. texted postive

Online

#4 2009-09-11 22:20:09

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: having urls in custom fields

Yes.

<txp:upm_textile><txp:custom_field name="yourcustomfieldname" /></txp:upm_textile>.

Reading plugin help may help you next time.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#5 2009-09-11 22:34:07

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

Re: having urls in custom fields

this is what i entered:
<txp:upm_textile><txp:custom_field name="Source Field"/></txp:custom_field> </txp:upm_textile>

and still not working


…. texted postive

Online

#6 2009-09-11 23:06:17

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

Re: having urls in custom fields

if one enters this it does work
<txp:upm_textile>Sources for this entry: "Textiled":http://textism.com/tools/textile/.</txp:upm_textile>

but this doesn’t
<txp:upm_textile>For Further Information <txp:if_custom_field name="SourceField"> </txp:if_custom_field> </txp:upm_textile>

So how can i have URLs in a custom field and have them display as links?


…. texted postive

Online

#7 2009-09-11 23:31:10

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: having urls in custom fields

Take a look at your code:

This one:
<txp:upm_textile><txp:custom_field name="Source Field"/></txp:custom_field> </txp:upm_textile>
is somehow wrong.
<txp:custom field name="SourceField" /> is a self-closing (aka single) tag. Although you have closed it properly, the extra </txp:custom_field> may be interfering.

Then, this one:
<txp:upm_textile>For Further Information <txp:if_custom_field name="SourceField"> </txp:if_custom_field> </txp:upm_textile>
is “wrong” too.
There is nothing inside the <txp:if_custom_field></txp:if_custom_field>, so what do you expect it to output.

This should work:
<txp:upm_textile><txp:custom_field name="SourceField" /></txp:upm_textile>
or even this, to output nothing if cfield is empty:
<txp:if_custom_field name="SourceField"><txp:upm_textile><txp:custom_field name="SourceField" /></txp:upm_textile></txp:if_custom_field>

Finally, what is the name of your custom field? Remember that you can only use characters, numbers and underscores. Spaces or hyphens are not allowed.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#8 2009-09-12 05:55:37

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: having urls in custom fields

If it is just urls you wish to have in there it would be more efficient in the long ran if you had something like

<txp:if_custom_field name="url">
<a href="<txp:custom_field name="url" />">Go to website</a>
</txp:if_custom_field>

Last edited by colak (2009-09-12 05:55:54)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#9 2009-09-12 06:24:35

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: having urls in custom fields

colak wrote:

If it is just urls you wish to have in there it would be more efficient in the long ran if you had something like

Especially when the varchar(255) field can store only 255 chars (in UTF8toUTF8 situation), if not changed to bigger.

Also, in colak’s example, it’s easier to restyle the links afterwards, the code is parsed faster (no onpage textile call) and putting the link inside the field is a lot easier for Textile noob, and it’s harder to typo the link.

Offline

#10 2009-09-12 20:47:50

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

Re: having urls in custom fields

maniqui wrote:

Take a look at your code:

This one:
<txp:upm_textile><txp:custom_field name="Source Field"/></txp:custom_field> </txp:upm_textile>
is somehow wrong.
<txp:custom field name="SourceField" /> is a self-closing (aka single) tag. Although you have closed it properly, the extra </txp:custom_field> may be interfering.

Then, this one:
<txp:upm_textile>For Further Information <txp:if_custom_field name="SourceField"> </txp:if_custom_field> </txp:upm_textile>
is “wrong” too.
There is nothing inside the <txp:if_custom_field></txp:if_custom_field>, so what do you expect it to output.

This should work:
<txp:upm_textile><txp:custom_field name="SourceField" /></txp:upm_textile>
or even this, to output nothing if cfield is empty:
<txp:if_custom_field name="SourceField"><txp:upm_textile><txp:custom_field name="SourceField" /></txp:upm_textile></txp:if_custom_field>

Finally, what is the name of your custom field? Remember that you can only use characters, numbers and underscores. Spaces or hyphens are not allowed.

thank-you for your response. But of the suggestions worked. I would have thought that what was being proposed _should _ have worked… alas not.


…. texted postive

Online

#11 2009-09-12 20:53:23

bici
Member
From: vancouver
Registered: 2004-02-24
Posts: 2,091
Website Mastodon

Re: having urls in custom fields

colak wrote:

If it is just urls you wish to have in there it would be more efficient in the long ran if you had something like

<txp:if_custom_field name="url">
<a href="<txp:custom_field name="url" />">Go to website</a>
</txp:if_custom_field>

B I N G O ! Many thanks!

Your solution is what i was after. I do in fact just want to be able to add an URL to that Custom Field.

PS why is the custom field only one line in height. what if i wish to output two urls, or more generally what if i wish to use a custom field for some longish text. It would be difficult to edit text of two or three lines. Is there a way to customize this?

Last edited by bici (2009-09-12 21:11:02)


…. texted postive

Online

#12 2009-09-13 05:36:37

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: having urls in custom fields

Hi Giovanni

As jukka pointed out: Custom fields have a “varchar(255) which can store only 255 chars (in UTF8toUTF8 situation)”.

Since the beginning custom fields were designed for just short pieces of text. If you wish to have more than one url you can use another custom field.


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

Board footer

Powered by FluxBB