Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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.
Offline
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
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.
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
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
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