User talk:Mathsinger

From Organic Design wiki

Hi :-) let me know if you need any help - the MediaWiki code snippets article has some quite useful stuff in it. --nad 21:09, 16 April 2009 (UTC)

Well, I do have a question/issue. I would really like the RandomImage extension to be able to pull from a specific Category, rather than from the whole set of images. I have been fiddling with making a list using DPL, with the idea of making it the "choices" option. No luck..

Here are my attempts...

{{#vardefine:images|<dpl>
category=RandomImages
mode=inline
inlinetext=|
shownamespace=false
</dpl>}}
{{#var:images}}

{{#tag: randomimage
|test1
|float=right
|size=250
|choices={{#var:images}}
}}


{{#tag: randomimage
|test2
|float=right 
|size=250 
|choices=CliffordABurchsted.jpg|20070917-JohnsHouse01.jpg
}}

The second random image tag setup only shows the first image.

I am about ready to rewrite the RandomImage extension; I was really excited to find you had a page on it, as I thought you might be working on it. My big stumbling block to writing a new version is understanding how a random image is chosen. __METHOD__ doesn't make a lot of sense to me.

I am not sure that the DPL solution is very good, anyway, since I have hundreds of images -- only some of which I would like to display.

See http://www.gausschildren.org/genwiki if you want to see what I have now.

Here's a method that's a bit simpler, still using #tag and DPL:
{{#tag:randomimage
 | test2
 | float   = right 
 | size    = 100
 | choices = "{{#dpl:category=Emoticons|format=,%TITLE%{{!}},,}}"
}}

It's not quite perfect tho because the pipe list has a trailing pipe, so really needs a #substr or something, below is the result, only images for Category:Emoticons show. Note the {{!}} which is needed so that the string is build with pipes, but the pipe isn't confused with a parameter separator by the #dpl call.

<randomimage float="right" size="100" choices="Face-angel.svg|Face-crying.svg|Face-devilish.svg|Face-glasses.svg|Face-grin.svg|Face-kiss.svg|Face-monkey.svg|Face-plain.svg|Face-sad.svg|Face-smile-big.svg|Face-smile.svg|Face-stoned.svg|Face-surprise.svg|Face-wink.svg|"> test2

</randomimage>