Textpattern Forum

You are not logged in. Register | Login | Help

#1 2008-11-21 19:20:48

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

#2 2008-11-21 19:31:04

maniqui
Moderator
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 2,989
Website

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.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2008-11-21 19:34:00

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

Re: Add tag txp:if_article_image

I’ve never used it – but this might be what you need.

Scroll down a few posts.

There’s this too.

Last edited by renobird (2008-11-21 19:36:08)

Offline

#4 2008-11-21 19:42:32

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 4,971
Website

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.org | neme-imca.org | hblack.net | LABS

Offline

#5 2008-11-21 19:50:34

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

#6 2008-11-21 19:58:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 5,916
Website

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.

Txp Builders – finely-crafted code, design and Txp

Offline

#7 2008-11-21 20:03:06

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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
Admin
From: The Netherlands
Registered: 2004-06-06
Posts: 7,388
Website

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>

<txp:Els /> ;)
Tag Reference | Unexpected behaviour? Check the tag trace | Still no clue? Check the names of your custom fields

Offline

#9 2008-11-21 20:55:09

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

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

#10 2008-11-21 21:02:00

renobird
Member
From: Gainesville, Florida
Registered: 2005-03-02
Posts: 786
Website

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

Board footer

Powered by FluxBB