Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-12-25 10:18:40

Wolfgang
Member
From: Germany
Registered: 2006-07-18
Posts: 71
Website

The forms shall be used by the settings of custom field value ...

Hello

I’ve the following problem:

<txp:if_custom_field name="x">
  <txp:output_form form="<txp:custom_field name="x" />-y" />
</txp:if_custom_field>

If a special custum-field (name x) holds a value i.e. the Letter A, then the output-form A-y shall be used, otherwiese no.

But this formular does not work. Does anyone have an idea?

Best regards
Wolfgang

Last edited by Wolfgang (2008-12-25 10:47:15)

Offline

#2 2008-12-25 10:34:15

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: The forms shall be used by the settings of custom field value ...

You don’t need the output_form there, try just the custom_field tag and see what you get.

<txp:if_custom_field name="x">
  <txp:custom_field name="x" />-y
</txp:if_custom_field>

Offline

#3 2008-12-25 10:46:47

Wolfgang
Member
From: Germany
Registered: 2006-07-18
Posts: 71
Website

Re: The forms shall be used by the settings of custom field value ...

> You don’t need the output_form there, try just the custom_field tag and see what you get.

Ok, then I get the text A-y and not the content which is stored in the form with the name A-y

Offline

#4 2008-12-25 11:40:33

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: The forms shall be used by the settings of custom field value ...

Have you tried single quotes?

<txp:output_form form='<txp:custom_field name="x" />-y' />

Last edited by thebombsite (2008-12-25 11:41:00)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#5 2008-12-25 11:45:51

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: The forms shall be used by the settings of custom field value ...

Ah I see. You can use the new if_variable tag:

<txp:variable name="custom_field_x" value='<txp:custom_field name="x" />-y' />

Put that first, then:

<txp:if_variable name="custom_field_x" value="">
<txp:custom_field name="x" />-y
</txp:if_variable>

See if that works. You’ll need 4.07 of course!

Offline

#6 2008-12-25 12:11:38

Wolfgang
Member
From: Germany
Registered: 2006-07-18
Posts: 71
Website

Re: The forms shall be used by the settings of custom field value ...

<txp:output_form form='<txp:custom_field name="x" />-y' />

This will produce the result:

  -y' />

And the other part, you are right, I shall update the version.

Offline

#7 2008-12-25 12:17:39

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: The forms shall be used by the settings of custom field value ...

Wolfgang, if you are using 4.06 neither of the two methods will work. Can you update first and then try both methods, and let us know what works/does not work?

Offline

#8 2008-12-25 14:53:06

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

Re: The forms shall be used by the settings of custom field value ...

@Wolfgang,

your first example is ok. As bombsite said (but he did wrote it incorrectly) use single quotes:

So, this should work (on 4.0.7):

<txp:if_custom_field name="x">
  <txp:output_form form='<txp:custom_field name="x" />-y' />
</txp:if_custom_field>

Last edited by maniqui (2008-12-25 14:53:22)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB