Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: Come on, make if_data core
Yeah, I’ve used chh_if_data in a wide variety of scenarios. Although never before to test whether a donkey is sitting on my head. I suppose it’s possible.
Offline
Re: Come on, make if_data core
if_donkeys_sit_on_my_head
I think I have a use for that one. ;)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
#15 2009-03-10 22:20:14
- redbot
- Plugin Author
- Registered: 2006-02-14
- Posts: 1,410
Re: Come on, make if_data core
I agree with this proposal. As I said some months ago and humbly restate now, I think a simple txp:if_data would be either useful for the experienced textpatterner (less and cleaner code) as for the new textpattern user (even if you can obtain the same result using txp:if_variable.)
Offline
Re: Come on, make if_data core
pish posh. including an if_data tag is the more elegant and encompassing of the solutions – if_variable seems hackish in comparison. and I totally agree…it seems odd to bother with if_article_image – rather than covering all the scenarios with if_data.
as mrdale so eloquently wrote
It kinda opens the door to all kinds of silliness; if_body, if_sitename, if_filename, if_donkeys_sit_on_my_head, if_I_were_a_rich_man
word Dale. word.
:)
Last edited by renobird (2009-03-11 01:06:29)
Offline
#17 2009-03-11 09:37:00
- gomedia
- Plugin Author
- Registered: 2008-06-01
- Posts: 1,373
Re: Come on, make if_data core
I’ve used chh_if_data a couple of times with great success. However, it counts whitespace as “data” so I created a tweaked version to get around this.
I’d be interested to see whether <txp:if_variable name="hasdata" value="">
would work in the presence of whitespace.
Offline
Re: Come on, make if_data core
renobird wrote:
pish posh. including an if_data tag is the more elegant and encompassing of the solutions – if_variable seems hackish in comparison. and I totally agree…it seems odd to bother with if_article_image – rather than covering all the scenarios with if_data.
Well, if_data sounds great but it isn’t the all-around friend:
- It makes pages slower because it blindly parses the tag, when specific conditional tag just simply does fast check, not a parse-it-all.
- Multi-tag-support.
- if_variable covers those both: you can specify what the man uses to check the condition (but still is slower than real conditional tag), and you can use it with multiple tags.
if_data is a powerful tool which makes it neat. Thus, if you need it, you can use the plugin and not to use in build conditionals. If_data is good as a plugin.
Offline
Re: Come on, make if_data core
Still haven’t heard a compelling argument why we should have a specific tag to test for output from another specific tag while, a generalized tag is considered cruft, but I guess I don’t have to, I’m just someone who builds a lot of sites with this thing.
Offline
Re: Come on, make if_data core
Bump, So er… wet, rudd.
How about making this core to replace the more specific and less versatile if_article_image?
Twice (or more) as nice…
Last edited by mrdale (2009-03-16 17:09:00)
Offline
Re: Come on, make if_data core
mrdale wrote:
Bump, So er… wet, rudd.
How about making this core to replace the more specific and less versatile if_article_image?
Twice (or more) as nice…
Still, you sometimes will want to use the tag and conditional seperately, plus if_data is slower to parse than optimized conditional tag.
Remember, if you need it, it’s there as a plugin.
Last edited by Gocom (2009-03-16 19:57:07)
Offline
Re: Come on, make if_data core
Gocom wrote:
Still, you sometimes will want to use the tag and conditional seperately, plus if_data is slower to parse than optimized conditional tag.
Remember, if you need it, it’s there as a plugin.
Quite right. But to be clear I think if we’re adding tags (if_article_image) we should add ones that have more function to more people, In this case a tag that would serve both purposes gracefully.
Offline
Re: Come on, make if_data core
I’d be very interested in something like this. Right now I have:
<div class="imgInfo"><cite><txp:upm_img_alt /></cite>, <txp:upm_img_caption /></div>
but, unfortunately a couple of my images don’t have captions, only alts – and in that case I don’t want the comma. If I could output the comma only if there is a caption, that’d be swell, and it seems like <txp:if_data>
would do the trick.
Offline
Re: Come on, make if_data core
nabrown78 wrote:
that’d be swell, and it seems like
<txp:if_data>
would do the trick.
chh_if_data is your friend, just have to load it. My point is, that this is basic, and versatile enough to be core.
Last edited by mrdale (2009-03-25 18:36:49)
Offline