Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Add tag txp:if_article_image
There are a lot of core tags if_article_something
but very important if_article_image
is absent. It makes to use different way to achieve such logic…
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Add tag txp:if_article_image
Although I also think it should be a built-in tag, in the meanwhile, you can find it on upm_image plugin.
Offline
Offline
Re: Add tag txp:if_article_image
chh_if_data should do what you need
Last edited by colak (2008-11-21 19:43:23)
Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.
Offline
Re: Add tag txp:if_article_image
yep. Forgot about using chh_if_data for this.
That’s probably the cleanest solution, as it it can be used in a variety of other ways too.
Offline
Re: Add tag txp:if_article_image
the_ghost wrote:
if_article_image
is absent
Or if you already have it loaded on your site for other things, there’s:
<txp:smd_if field="article_image" operator="isused">
// Yay, there's an article image
</txp:smd_if>
:-)
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
Re: Add tag txp:if_article_image
Take home message:
There’s a bunch of ways to do this already – probably no need to add to the core.
:)
Bloke, nice – I never knew about that.
Offline
#8 2008-11-21 20:37:28
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Add tag txp:if_article_image
What about the ‘native’ way? – well, almost… ;)
<txp:variable name="article_img" value='<txp:article_image />' />
<txp:if_variable name="article_img" value="">
// No article image
<txp:else />
// Yay, there's an article image
</txp:if_variable>
Offline
Re: Add tag txp:if_article_image
I even didn’t think that community will found so many variants. But I know how to make such conditional check, or with the help of smd_if
, or with the help of txp:variable
. But I think, this tag should be in the core. I think it’s rather important tag. For me it’s even more important than txp:if_keywords
:)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Add tag txp:if_article_image
Victor,
I suspect there would be resistance to adding it to the core – since there are so many other ways to achieve the exact same thing with plugins.
Especially if the example Els posted above works…then you really already have the functionality built-in (it’s just not a single tag).
Any ‘ole how…this has been interesting…I definitely learned a few ways to approach this.
Last edited by renobird (2008-11-21 21:02:17)
Offline
Re: Add tag txp:if_article_image
Okay, okay. But i worry about more newbies than me. Thay could be confused by absent of if_article_image
‘cos it’s quite a logic and “simple” tag to be “built-in” without using rather long-codes of txp:variables and others ways.
Just worry about newbies :)
Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?
Offline
Re: Add tag txp:if_article_image
the_ghost wrote:
Just worry about newbies :)
There will be plenty to trip them up before that. :)
Just kidding. I hear ya.
Offline