Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2013-07-29 12:55:27

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Article image - allow duplicates image ids?

Just wondering if there is a way you can have the same image id in the article image field twice, or more times?

Its not a biggy – I was asked by a client today, and I said sure, just add it again…. then felt like an idiot when it didn’t work :)

It could be useful in certain situations, not the norm I know .

Offline

#2 2013-07-29 13:30:50

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: Article image - allow duplicates image ids?

tye wrote:

It could be useful in certain situations, not the norm I know .

Would like to read more about these certain situations.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#3 2013-07-30 06:44:06

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: Article image - allow duplicates image ids?

Yeah sure… I had a client who was pushing a music event… the normal form had 3 article images across the top of the page, in this instant he really like the band and they were going to be big $$$ for him – so he wanted their logo 3 times.

In another case, the first article image was set as a featured image on the home page, then he wanted that image to show again on the page – the form had been setup to offset the first image (as this was how the rest of the site worked) and he was struggling to find other images to fill the gap but wanted to keep design continuity.

Like I said, its not normal usage, but could be useful in certain situations.

Offline

#4 2013-07-31 05:59:31

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: Article image - allow duplicates image ids?

I don’t think the text box cares if an id is entered more than once. Are you using a plugin for the image selection to populate the field?

Then again, maybe the tag that uses the list doesn’t grab the image record more than once.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#5 2013-07-31 12:26:17

GugUser
Member
From: Quito (Ecuador)
Registered: 2007-12-16
Posts: 1,477

Re: Article image - allow duplicates image ids?

MattD wrote:

I don’t think the text box cares if an id is entered more than once.

I have tested this without a participating plugin. If the same image ID is several times in the article image field, then the image at the output is shown only once.

It would be interesting to see tyes code, why and how he needs the same image twice.

Last edited by GugUser (2013-07-31 12:29:37)

Offline

#6 2013-07-31 12:49:42

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Article image - allow duplicates image ids?

Core tags such as images will render single image just once. To include the same ID multiple times, you will have to result to a plugin, like rah_repeat:

<txp:if_article_image>
    <txp:rah_repeat value='<txp:custom_field name="article_image" />'>
        <txp:image id='<txp:rah_repeat_value />' />
    </txp:rah_repeat>
</txp:if_article_image>

Last edited by Gocom (2013-07-31 12:54:17)

Offline

#7 2013-07-31 22:55:20

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: Article image - allow duplicates image ids?

why and how is answered above.

here is my code

<txp:if_article_image><txp:images offset="1" sort='field(`ID`,<txp:custom_field name="article_image" />)' limit="4" /></txp:if_article_image>

I think Jukka answers the whole debate – thanks :)

Offline

Board footer

Powered by FluxBB