PHP Function parameters - problem with var not being set
- by Marty
So I am obviously not a very good programmer. I have written this small function:
function dispAdjuggler($atts) {
extract(shortcode_atts(array(
'slot' => ''
), $atts));
$adspot = '';
$adtype = '';
// Get blog # we're on
global $blog_id;
switch ($blog_id) {
case 1:
// root blog HOME page
if (is_home()) {
switch ($slot) {
case 'top_leaderboard':
$adspot = '855525';
$adtype = '608934';
break;
case 'right_halfpage':
$adspot = '855216';
$adtype = '855220';
break;
case 'right_med-rectangle':
$adspot = '858222';
$adtype = '613526';
break;
default:
throw new Exception("Ad slot is not defined");
break;
}
When I reference the function on a page like so:
<?php dispAdjuggler("top_leaderboard"); ?>
The switch is throwing the default exception. What am I doing wrong here?
Thanks!!