Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-10-13 23:14:11

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

Random image on article's list (like article_image)

Imaging i assigned two or more images to article (i mean i entered ids of images to textarea at article edit page). How can i output one of them randomly on page with articles list like article_image tag works? But article_image displays works only with one image…


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 2007-10-14 06:42:20

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: Random image on article's list (like article_image)

would this help?


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2007-10-14 08:51:56

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

Re: Random image on article's list (like article_image)

dru_random_image and mem_randimg will select a random image by category, but to my knowledge not out of the list of article images (do correct me if I’m wrong). I briefly looked at other plug-ins like wet_for_each_image (v. powerful but for whole image collections) and wet_thumbfilter (will do lists of article images from several articles but as far as I can see not within an article). More article plug-ins available are listed on textpattern resources.

For building lists of article_images and article_thumbs I always found hak_article_image most useful. It already has attributes such as offset to not start with the first image in the list or do multiple-column lists, so I can imagine it would not be difficult to build in/hack a sortorder or random attribute to hak_article_image which you could then fill with sortorder="rand()" — or perhaps more simply random="y" as other sort orders aren’t really relevant for images. If you can’t do it yourself, maybe it’s worth asking hakjoon for that.

Then again, maybe there’s an easier way?


TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB