Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-03-02 14:21:51

dandul
Member
From: Brisbane, Australia
Registered: 2010-01-31
Posts: 33

can't get nested tags to work

Hi

I have a custom field called mainPic, and I’m using that to store an image id number – in this case “12”

If I have this <txp:custom_field name="mainPic" /> it displays “12”.

And this <txp:image id="12" /> displays the image.

So I tried to combine them: <txp:image id='<txp:custom_field name="mainPic" />' /> but nothing happened.

I tried putting the custom field name in a form and doing this: <txp:image id='<txp:output_form form="mainPicNumber" />' />

I’ve looked at the tag parser article – and I seem to have single quotes outside and double quotes inside. Sorry – I can’t figure what I’m doing wrong. Can anyone help?


Stop wishing things were different to the way they are. Accept it, deal with it, move on.

Offline

#2 2010-03-02 14:25:24

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

Re: can't get nested tags to work

dandul wrote:

I seem to have single quotes outside and double quotes inside

My guess is this is because of Textile getting in the way. If you’ve put your tags inside an article, try either surrounding the entire <txp:image> tag with pairs of == or put two spaces at the start of the line containing the image tag. That should turn textile off for just that portion of your article and then the tags can be parsed properly.

Last edited by Bloke (2010-03-02 14:25:58)


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

#3 2010-03-02 15:21:49

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

Re: can't get nested tags to work

You also need Txp 4.0.8 or higher ;)

Offline

#4 2010-03-02 17:02:20

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

Re: can't get nested tags to work

Els wrote:

4.0.8 or higher

4.0.7 ;)

Offline

#5 2010-03-02 17:15:51

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

Re: can't get nested tags to work

Gocom wrote:

4.0.7 ;)

Really?? D’oh!

Offline

#6 2010-03-02 22:38:47

dandul
Member
From: Brisbane, Australia
Registered: 2010-01-31
Posts: 33

Re: can't get nested tags to work

Thanks Bloke, that worked. And yes txp version = higher than 4.0.7 Using 4.2.

For the record it looks like this in the article == <txp:image id='<txp:custom_field name="mainPic" />' /> == and voila! An image is born.

Thanks everyone for sharing your knowledge, it is VERY much appreciated. :)


Stop wishing things were different to the way they are. Accept it, deal with it, move on.

Offline

#7 2010-03-02 23:28:59

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

Re: can't get nested tags to work

dandul wrote:

  • ..in the article* == <txp:image id='<txp:custom_field name="mainPic" />' /> ==

Why on earth would you want to type both the id in the custom field and <txp:custom_field name="mainPic" /> in the image tag, instead of just <txp:image id="12" />? Because I can’t see your tag in an article doing anything more than just that.

Offline

#8 2010-03-03 00:13:41

dandul
Member
From: Brisbane, Australia
Registered: 2010-01-31
Posts: 33

Re: can't get nested tags to work

Hi Els

Bear with me, I don’t really know what I’m doing… (warning: programmers will probably find the following story exasperating)

I’m using the plug-in upm_article_image@@ to generate thumbnails of images relevant to the article, which it does so using the article image@@ field.

If there’s one ID number in the article image@@ field Txp puts that particular image in the article body.

However when I add more than one ID number to the Article image field I lose the large image in the body – instead I have a series of thumbnails.

In the page template I’m using this code (which I copied from a forum post somewhere):
<div id=“article-image”>
<txp:upm_article_image limit=“20” form=“article_image_thumbs” wraptag=“ul” class=“ai_thumbs” />
</div>@@

and then in the article I’m typing the numbers into the ID box.

So I tried to think of a way to get a big image back and that was the best idea I came up with… Make a custom field with the ID number of the picture I want and then insert. Duplicating what article image did before I used the upm_article_image@@ plug-in.

Probably a very simple and elegant solution exists… if anyone knows it I’d be delighted to be instructed!

:)


Stop wishing things were different to the way they are. Accept it, deal with it, move on.

Offline

#9 2010-03-30 04:56:01

nestorrojas
New Member
From: atlanta
Registered: 2009-10-14
Posts: 2
Website

Re: can't get nested tags to work

I’m working on a form that allows a web admin to update the pricing on for the select services/items I’m using the <txp:custom_fields> tag within the zem_contact_reborn here is the code:
————————————————————————————————————————————————————————————————

<txp:zem_contact to="info@domain.com label="" subject="select price">
<txp:zem_contact_text label="Name" max="28" required="1" break="<br/>">
<txp:zem_contact_email break="<br/>"/>
<txp:zem_contact_text label="Phone" min="7" max="15" required="1" break="<br/>"/>

<txp:zem_contact_select label="Select" list="<txp:if_custom_field name='item_price_a'/>,<txp:if_custom_field name='item_price_b'/>" break="<br />"/>

<txp:zem_contact_textarea name="instructions" label="Special instructions" required="boolean" break="<br/>" rows="" cols=""/> 

<txp:zem_contact_checkbox name="notspam" label="This is not SPAM" />
  <txp:zem_contact_submit label="Order Now" />
</txp:zem_contact>

———————————————————————————————————————————————————————————-

I’ve been reading tags within tags forum thread, but can’t find anything related to this issue. From what I’m getting is that custom_fields tags need to be w/in an article tag///but I can’t figure out to to implement this with the zem_contact_reborn///

can anybody point me in the right direction on how to implement this w/out getting to use php my is very very basic

Thanks in advance

Offline

#10 2010-03-30 07:25:43

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

Re: can't get nested tags to work

<txp:zem_contact_select label="Select" list='<txp:if_custom_field name="item_price_a"><txp:custom_field name="item_price_a" /></txp:if_custom_field><txp:if_custom_field name="item_price_b">,<txp:custom_field name="item_price_b" /></txp:if_custom_field>' />

Or, if you don’t need to check if the custom fields are filled:

<txp:zem_contact_select label="Select" list='<txp:custom_field name="item_price_a" />,<txp:custom_field name="item_price_b" />' />

You don’t need the break attribute because its default value is <br />.

(Parsing Tag Attributes)

Last edited by els (2010-03-30 07:27:13)

Offline

Board footer

Powered by FluxBB