Your function isn't returning anything. This would be a quick fix:
PHP Code:
<?php
function ArtScheme($SchemeSelected){
switch($SchemeSelected)
{
case "home":
include ('homescheme.php');
break;
default: echo "Your Color Scheme does not work";
}
return $color;
}
?>
$SchemeNeeded = "home";
$color = ArtScheme($SchemeNeeded);
<table width="775" border="0" cellpadding="1" cellspacing="0" bgcolor="<?php echo $color['border']?>">
<?php
// this in the include file
$colorscheme['home']['highlight'] = "#EBD7AB";
$color['border'] = "#CC9933";
$color['stripe'] = "#FFFFCE";
?>
And this is another, more compact, way:
PHP Code:
<?php
include('colorschemes.inc.php');
$SchemeNeeded = "home";
$color = $colorscheme[$SchemeNeeded];
?>
<table width="775" border="0" cellpadding="1" cellspacing="0" bgcolor="<?php echo $color['border']?>">
<?php
// the below goes in the include file colorschemes.inc.php
$colorscheme = array(
'home' => array('highlight' => '#EBD7AB', 'border' => '#CC9933', 'stripe' => '#FFFFCE'),
'away' => array('highlight' => '#FFFF00', 'border' => '#FF0000', 'stripe' => '#CCCCCC')
);
?>
No need for functions, just use the power of the array!
Well, and if I can be a pain, why not use CSS and load a different stylesheet?
Have fun with it!
Rik
Bookmarks