Go to main content

Textpattern CMS support 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
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
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: 9,007
Website GitHub Mastodon Twitter

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

#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: 11,250
Website GitHub

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

#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
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

#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

#11 2008-11-21 21:43:45

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

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

#12 2008-11-21 21:48:29

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

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

Board footer

Powered by FluxBB