You would think this would be easy. I have a problem getting my variables to insert into the HTML page that requests them.
I am trying to make 9 "dealers" randomize into 6 "slots" and take another 5 "dealers" to randomize into 2 "slots". The output should look like this: http://wilsonelectronics.com/Dealer.php (the BUY NOW section).
This is the code I am using (with comments to explain):
<?php
// BUY NOW! Dealers. Create the Function
function BuyNow($dealer, $web, $site, $rank){
// Define the variables $dealer, $web, $site and $rank
$New[] = BuyNow('dealer1', 'web1', 'http://www.site1.com', '1');
$New[] = BuyNow('dealer2', 'web2', 'http://www.site2.com', '1');
$New[] = BuyNow('dealer3', 'web3', 'http://www.site3.com', '1');
$New[] = BuyNow('dealer4', 'web4', 'http://www.site4.com', '1');
$New[] = BuyNow('dealer5', 'web5', 'http://www.site5.com', '1');
$New[] = BuyNow('dealer6', 'web6', 'http://www.site6.com', '1');
$New[] = BuyNow('dealer7', 'web7', 'http://www.site7.com', '1');
$New[] = BuyNow('dealer8', 'web8', 'http://www.site8.com', '1');
$New[] = BuyNow('dealer9', 'web9', 'http://www.site9.com', '1');
$New[] = BuyNow('dealer10', 'web10', 'http://www.site10.com', '0');
$New[] = BuyNow('dealer11', 'web11', 'http://www.site11.com', '0');
$New[] = BuyNow('dealer12', 'web12', 'http://www.site12.com', '0');
$New[] = BuyNow('dealer13', 'web13', 'http://www.site13.com', '0');
$New[] = BuyNow('dealer14', 'web14', 'http://www.site14.com', '0');
// Define Plug in Variables
$New['dealer'] = $dealer;
$New['web'] = $web;
$New['site'] = $site;
return $New;
// Randomize the array
shuffle($New);
return $New;
// Make a block
$Tpl->MergeBlock('New', $New);
// Separation of dealers
if($rank = 1){
$Top = $New[];
}else{
$Bottom = $New[];
}
// Make Blocks 'Top' and 'Bottom'
$Tpl->MergeBlock('Top', $Top);
$Tpl->MergeBlock('Bottom', $Bottom);
}
?>
I used the $rank variable to define the value of the dealer, since the rank may change every month or so. Can anyone explain to me why I can't get the blocks 'Top' and 'Bottom' to plug into the HTML file? I get these results http://wilsonelectronics.com/Dealer3.php.
Please help ???