How to display random pictures

... in the header, for example like on http://chregu.freeflux.net/

Open master.xsl and search for <div id="banner">, and replace it with

<div id ="banner" >
 <xsl:variable name="rand">
   <xsl:value-of select="php:functionString('bx_helpers_int::getRand', '1','14')"/>
 </xsl:variable>
 <xsl:attribute name="style">background-image: url('/files/header_small/pic<xsl:value-of select="$rand"/>.jpg')</xsl:attribute>

In the example above, you'd now have to upload 14 different pictures into /files/header_small/ with the names pic1.jpg, pic2.jpg, pic3.jpg, etc. Adjust the code accordingly :)

Now, a different (randomly selected) background image should appear for the banner-div. You can of course use the same technique for any other element.

Comments (3)  Permalink

Comments

suls @ 22.08.2006 09:30 CET
mich würde eigentlich mehr interessieren wie du die plazer-tags via moblog hingebracht hast..
hast du den mobile-client von plazer benutzt?
chregu @ 22.08.2006 09:36 CET
Suls: Das sind nicht wirklich Plazer-tags, sondern einfach geotags (der link zu sardinia ist auch sinnlos jeweils).

Wie man das macht, steht hier und ich habe einfache die Koordinaten vom GPS abgelesen :)
suls @ 22.08.2006 12:11 CET
Alles klar.. hab schon auf ein neues gimmick gehofft ;)
No new comments allowed (anymore) on this post.