Friday, December 09, 2011

Including random number (timestamp) in vBulletin

This is useful for 'cache busting' (most commonly used with advertising code that requires a random number). So, if you want to easily include a random number (actually a timestamp) in your vBulletin templates, simply use this code:

<if condition="$randomvar = TIMENOW">$randomvar</if>

Every time I forget the syntax for this, I end up searching vBulletin.org before eventually realising the solution is actually on this thread at vBulletin.com! To avoid me wasting time again in the future, I decided to post this to my blog for reference.