Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2015-07-18 08:10:54

etc
Developer
Registered: 2010-11-11
Posts: 4,675
Website GitHub

Re: Randomly ordered images permlinked to their respective articles...

gomedia wrote #293456:

I don’t think that’s a problem with what I suggested – it runs on article IDs until the last moment, when a link is output.

Sure, but what you suggest either (with limit="1") outputs one image per article, or (without limit) leaves them grouped by article. That’s not what Stacey wants, and you obtain the same result with

<txp:article_custom sort="rand()">
	<txp:if_article_image>
		<txp:images sort="rand()">
			<txp:permlink><txp:image /></txp:permlink>
		</txp:images>
	</txp:if_article_image>
</txp:article_custom>

But if you do need a delimiter with adi_list then use separator="|" or some such and change default_separator to be something different (it defaults to "|").

Good to know, I haven’t found separator attribute on your site.

Last edited by etc (2015-07-18 08:15:05)

Offline

#14 2015-07-18 09:51:19

gomedia
Plugin Author
Registered: 2008-06-01
Posts: 1,372
Website

Re: Randomly ordered images permlinked to their respective articles...

etc wrote #293459:

Sure, but what you suggest either (with limit="1") outputs one image per article, or (without limit) leaves them grouped by article. That’s not what Stacey wants

Must’ve misunderstood, I thought one random image from one random article was the requirement.

Good to know, I haven’t found separator attribute on your site.

I’ll look into that, thanks.

Offline

#15 2015-07-18 10:16:11

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

Re: Randomly ordered images permlinked to their respective articles...

I love it that there are so many different ways to do things. When I first read the question I thought “that’s a tough one”, but our collective input adds more ideas to the pool.

Oleg, you’re right: I had assumed rah_repeat would support sort="rand()". Would need trying…

adi_list is another one I’ve overlooked – must try that out sometime.


TXP Builders – finely-crafted code, design and txp

Offline

#16 2015-07-18 14:36:08

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Randomly ordered images permlinked to their respective articles...

This is something that should be kept on TXP Tips for posterity. But who is the author…?!

Offline

#17 2015-07-18 14:49:53

etc
Developer
Registered: 2010-11-11
Posts: 4,675
Website GitHub

Re: Randomly ordered images permlinked to their respective articles...

jstubbs wrote #293475:

This is something that should be kept on TXP Tips for posterity. But who is the author…?!

Depends on what is this

Offline

#18 2015-07-18 14:51:17

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Randomly ordered images permlinked to their respective articles...

etc wrote #293476:

Depends on what is _this_…

Also..!

Offline

#19 2015-07-18 15:24:51

etc
Developer
Registered: 2010-11-11
Posts: 4,675
Website GitHub

Re: Randomly ordered images permlinked to their respective articles...

Looks like a good occasion to test your “switch author” plugin, Jonathan. ;)

Offline

#20 2015-07-19 00:09:53

jstubbs
Moderator
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Randomly ordered images permlinked to their respective articles...

But who would be the author Oleg..?!!

Offline

#21 2015-07-19 06:59:16

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 8,881
Website GitHub Twitter

Re: Randomly ordered images permlinked to their respective articles...

jstubbs wrote #293492:

But who would be the author Oleg..?!!

I’m not sure if the question is fully answered yet. I’d like to hear from photonomad what code he used and if we can see the result online.


Yiannis
——————————
neme.org | hblack.net | EMAP | NeMe @ github
I do my best editing after I click on the submit button.

Offline

#22 2015-07-19 19:58:39

etc
Developer
Registered: 2010-11-11
Posts: 4,675
Website GitHub

Re: Randomly ordered images permlinked to their respective articles...

Take a look at Stacey site, the problem seems solved. I suggest we ask Stacey to write a tip.

Offline

Board footer

Powered by FluxBB