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 10:30 CEST
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 10:36 CEST
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 13:11 CEST
Alles klar.. hab schon auf ein neues gimmick gehofft ;)

add a comment

This blog is gravatar enabled.
Your email adress will never be published.
Comment spam will be deleted!

Name*
E-Mail
For Spammers Only
URL
Comment*
Notify me via E-Mail when new comments are made to this entry
Remember me (needs cookies)