sof-guild
07-24-2006, 02:18 AM
I have some experience with PHP, but none with vB. I've just been reskinning my first forum, and would like to be able to randomly select a different header image for each session. I know how I would do this in PHP, but am hoping someone can help me translate it to PHP.
Here's how I would approach the top of each page in PHP:
<?
$headerimg = 0;
$maximages = 6;
if ($_SESSION['header'] != "") {
$headerimg = rand(0,$maximages);
$_SESSION['header'] = $headerimg;
} else {
$headerimg = $_SESSION['header'];
}
?>
Then, in the header, I could just have <img src="/_images/header<?= $headerimg ?>">
Where do I put this code in my forum to set the variable, and how do I successfully retrieve the variable in the header template?
Thanks for your help.
Here's how I would approach the top of each page in PHP:
<?
$headerimg = 0;
$maximages = 6;
if ($_SESSION['header'] != "") {
$headerimg = rand(0,$maximages);
$_SESSION['header'] = $headerimg;
} else {
$headerimg = $_SESSION['header'];
}
?>
Then, in the header, I could just have <img src="/_images/header<?= $headerimg ?>">
Where do I put this code in my forum to set the variable, and how do I successfully retrieve the variable in the header template?
Thanks for your help.