Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
custom_field within article_custom tag
I’m just wondering if anyone can spot any issues with the following syntax which would cause Textpattern to throw out a Textpattern Notice: Unknown tag attribute: name error?
<txp:if_custom_field name="TargetAdvert">
<txp:article_custom form="fh-inner-sponsor-eng" pgonly="0" section="Sponsors" id="<txp:custom_field name="TargetAdvert" />" />
<txp:else />
<txp:article_custom form="fh-inner-sponsor-eng" pgonly="0" section="Sponsors" sort="rand()" status="5" limit="1" />
</txp:if_custom_field>
What I’m trying to do is: if the custom field has a value in it, then display content as per the first article_custom but display the particular article ID that’s been put in the custom field. If not, just display a random article.
I’ve tried wrapping <asy_wondertag>‘s around it but that didn’t help either.
I’ve been away from Txp for a bit and I’m a bit stumped even though I’ve managed to make something like this happen several times in the past!
TIA!
Reuben Whitehouse ~ Rocketfuelled
Offline
Re: custom_field within article_custom tag
You can’t have tags in side tags with out asy_wondertag or php. To make sure, it’s <txp:asy_wondertag> not <asy_wondertag> ;)
So: <txp:asy_wondertag><txp:article_custom form="fh-inner-sponsor-eng" pgonly="0" section="Sponsors" id="<txp:custom_field name="TargetAdvert" />" /></txp:asy_wondertag>
Last edited by Gocom (2008-02-06 02:13:43)
Offline
Re: custom_field within article_custom tag
Ah! Thanks Gocom – I think I’d been closing the tag wrong like so: </asy_wondertag> hence the increased problems I got when trying to use it.
Thanks again, I was going around in circles for a while there!
Reuben Whitehouse ~ Rocketfuelled
Offline
#4 2008-02-11 20:21:14
- mercyskye
- New Member
- Registered: 2008-02-11
- Posts: 4
Re: custom_field within article_custom tag
Hello—I am rather new to TXP and was searching for how to put tags within tags, when I came across this response. I couldn’t have found “asy_wondertag” in any documentation, so I’m fortunate to have stumbled upon it here.
However, when I attempt to use it, all the code between it disappears. Here is what I am trying to do:
<txp:if_custom_field name="thumb_list">
Click the thumbnail to view the full-size image.
<txp:asy_wondertag>
<txp:rss_thumbpop category="<txp:custom_field name="thumb_list" />" mode="float" orderby="dateasc" pagepop="1" padheight="100" cols="1" />
</txp:asy_wondertag>
</txp:if_custom_field>
I don’t receive any errors, I just get the “Click the thumbnail…” message with nothing underneath it. I do know there should be thumbnails because when I hard code the field name, it works as expected.
Thanks for any and all input…
Offline
#5 2008-02-11 20:47:18
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: custom_field within article_custom tag
Are you sure your custom field ‘thumb_list’ holds the exact category name (so not the title)? The code looks all right to me.
Offline
#6 2008-02-11 21:17:01
- mercyskye
- New Member
- Registered: 2008-02-11
- Posts: 4
Re: custom_field within article_custom tag
@Els—thanks for your reply.
Here’s what I know:
The category for the pictures/thumbnails is: 2-07-08_images
In the article to be published, under my Advanced Options—>thumb_list field, I have: 2-07-08_images
As I said, if I remove the tag which calls the value of the custom field name and replace it with “2-07-08_images” this works fine. Also, based on your comment, I checked and the category name and title are the same.
It should be noted, also, that as I was clearing this up for publication, I replaced the tag with the hard-coded category name, but forgot to remove my “asy_wonderland” tags. When I went back to my webpage, it was still blank between the tags. Only when I removed them did anything show up (and then it showed up correctly, hard-coded though).
Is there an admin setting I’m missing?…
Offline
#7 2008-02-11 21:34:48
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: custom_field within article_custom tag
I suppose it is a simple typo but in your code are you using <txp:asy_wondertag> or <txp:asy_wonderland>?
Offline
#8 2008-02-11 21:47:04
- mercyskye
- New Member
- Registered: 2008-02-11
- Posts: 4
Re: custom_field within article_custom tag
@redbot—LOL. My message has the typo, sorry, but my code as quoted above is actually correct (wonderTAG). Sorry for that.
Offline
#9 2008-02-11 21:53:42
- mercyskye
- New Member
- Registered: 2008-02-11
- Posts: 4
Re: custom_field within article_custom tag
To all—please disregard. I figured this out (user error, as I suspected. :-p ).
Thanks,
Offline
#10 2008-02-11 22:23:06
- nardo
- Member
- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: custom_field within article_custom tag
txp:asy_wonderland
– LOL
that should be a tag… maybe it can output DCA’s current location
Offline
#11 2008-02-11 22:32:07
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: custom_field within article_custom tag
mercyskye wrote:
I figured this out (user error, as I suspected. :-p ).
Forgot to activate the plugin? ;)
Offline