Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
[solved] A question of punctuation: tag nesting
I’m nesting tags three-deep, and I think I’ve got a tag attribute included incorrectly. I set a variable in my page, thus:
<txp:variable name="url_lemon" value="http://example.com" />
My section lemon
is an article list, and in the article form I have this logic:
- if the article custom field
url
is set, use that as the hyperlink target - if the article custom field
url
is not set, use theurl_lemon
as the hyperlink target
My code:
<a href='
<txp:if_custom_field name="url">
<txp:custom_field name="url" />
<txp:else />
<txp:variable name="url_<txp:section title=''1'' />" />
</txp:if_custom_field>'>[...]</a>
If I substitute the variable
chunk for #
(i.e., something without delimiters), it works; but the code above doesn’t retrieve the variable
. The problem, I think lays with the punctuation I’m using with the delimiter, and the ''
being interpreted as a "
– either that or I’m trying to nest too deeply. I’d be grateful for an extra pair of eyes on this, if anyone has any ideas. Thanks in advance.
Last edited by gaekwad (2014-02-05 14:32:48)
Offline
Re: [solved] A question of punctuation: tag nesting
Double quotes are ok in HTML tags (even nested like <a href="<txp:tag attr="hi" />">...</a>
), but not in txp tags:
<txp:variable name="url_<txp:section title=''1'' />" />
looks for a variable literally named url_<txp:section title=’‘1’‘ />. This should work (untested):
<a href="
<txp:if_custom_field name="url">
<txp:custom_field name="url" />
<txp:else />
<txp:variable name='url_<txp:section title="1" />' />
</txp:if_custom_field>">[...]</a>
Offline
Re: [solved] A question of punctuation: tag nesting
Thank you, Oleg – I appreciate your time and attention.
I’ll send the envelope of used € notes to the usual place.
Offline
Re: [solved] A question of punctuation: tag nesting
gaekwad wrote #278675:
I’ll send the envelope of used € notes to the usual place.
Ecology-minded people are always a pleasure to help! While we are at tags parsing, it’s useful to know that txp sees and transforms nothing but <txp:tags />
. Everything outside them (including quotes, matched or not) is just meaningless text.
Offline
Re: [solved] A question of punctuation: tag nesting
Offline