Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-06-23 14:59:15

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

<txp:article_image_url>

I know it’s kind of doable with ump_image and a couple of other plugins, but it would be really handy to have a core TXP tag for <txp:article_image_url>, since we already have one for <txp:image_url>.

Offline

#2 2011-06-23 15:09:28

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: <txp:article_image_url>

philwareham wrote:

it would be really handy to have a core TXP tag for <txp:article_image_url>

I think this is equivalent:

<txp:images>
   <txp:image_url />
</txp:images>

The images tag defaults to reading its context from the article image field — and will honour any list if it contains a comma-separated list of IDs. If you’re not sure if the article image is going to contain something you can wrap that lot in <txp:if_article_image>.

Last edited by Bloke (2011-06-23 15:09:55)


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

#3 2011-06-23 15:10:11

Dragondz
Moderator
From: Algérie
Registered: 2005-06-12
Posts: 1,538
Website GitHub Twitter

Re: <txp:article_image_url>

that doable without a plugin but need more tag:

<txp:images auto_detect="article"><txp:image_url /></txp:images>

Cheers

PS: bloke beat me today ;)

Last edited by Dragondz (2011-06-23 15:10:45)

Offline

#4 2011-06-23 15:14:28

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,731
Website

Re: <txp:article_image_url>

This also works:

<txp:image_url id='<txp:custom_field name="article_image" />' />

TXP Builders – finely-crafted code, design and txp

Offline

#5 2011-06-23 15:16:24

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,454
Website GitHub

Re: <txp:article_image_url>

jakob wrote:

<txp:image_url id='<txp:custom_field name="article_image" />' />

Forgot about that cheat. I like the cut of your jib, sir.

EDIT: though that’ll only work (uhh, I think, haven’t tried) if there’s one image ID.

Last edited by Bloke (2011-06-23 15:18:10)


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

#6 2011-06-23 15:27:25

philwareham
Core designer
From: Haslemere, Surrey, UK
Registered: 2009-06-11
Posts: 3,564
Website GitHub Mastodon

Re: <txp:article_image_url>

Great thinking ‘outside the box’ there (for want of a better phrase). Thanks people.

Offline

#7 2011-06-23 22:39:07

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,731
Website

Re: <txp:article_image_url>

though that’ll only work if there’s one image ID.

Yep, you’re right. For a comma-separated list of image IDs, you can use rah_repeat or your very own smd_each:

<ul>
  <txp:rah_repeat value='<txp:custom_field name="article_image" />'>
    <li><a href="<txp:image_url id='<txp:rah_repeat_value />' />" rel="lightbox"><txp:thumbnail id='<txp:rah_repeat_value />' /></a></li>
  </txp:rah_repeat>
</ul>

Last edited by jakob (2011-06-23 22:39:50)


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB