Hi,

I need a little help! Okay maybe a lot. I am trying to get a scrolling banner integrated with the zen cart main page in the center column. The problem is that I can't see a problem but the scrolling banners are not showing up on the page. Sorry but this is kind of long.

I am using zen cart 1.3.8a and it is a fresh install.

Here is what I have tried.

-> jscript_bannerstart.php in the ../includes/templates/classic/jscript/ directory to get the script loaded in the <head></head> section of the page. This is a dynamic db driven php script that creates the javascript arrays for the scroller script.

-> on_load_bannerstart.js to call onload= in the body.

-> added the javascript code in the define_main_page.php under ../includes/languages/english/html_includes/classic/ directory.

When I load the page I don't see the banner scroller anywhere. If I look at the page source everything is there as I would expect to see it. The js functions are loaded in the <head> area. The onload call is in the body tag and the display script is where it should be on the page. It looks identical to the source if I run the script on a test page outside of zencart (where it works fine by the way).

If I copy the code that is generated by the php script from the view source of the page and paste it into the html_header.php page the scroller seems to work somewhat. At least I get the container that will display the banners. I still don't see the banners scrolling though. It is the same code that the php script outputs!

I am really at a loss.

Any help is appreciated. Below is some of the code. The display code and js functions are missing but as I said it works as a stand alone not in zen cart.


------PHP script------

global $db;
$query = "(SELECT * FROM banner_scroller WHERE banner_scroller.bs_active = 1)";
$result=$db->Execute($query);

while (!$result->EOF)
{
$bannerId[] = $result->fields['bs_banner_id'];
$bannerImageName[] = $result->fields['bs_banner_image_name'];
$bannerTarget[] = $result->fields['bs_banner_target'];
$result->MoveNext();
}

$bannerCount = sizeof($bannerId);


echo "<script type='text/javascript'>";
echo "var swidth=650;var sheight=150;";
echo "var sspeed=18;var restart=sspeed;var rspeed=sspeed;var spause=3000;";
echo "var sbcolor='#cdcd9b';";


//dynamically create the preloads for the script based on mysql query
for ($i=0; $i < $bannerCount; $i++)
{
echo "preload" . $bannerId[$i] . "=new Image();";
echo "preload" . $bannerId[$i] . ".src='../images/images/" . $bannerImageName[$i] . "';";
}
echo "var singletext=new Array();";
//dynamically create the scroll array
for ($b=0; $b < $bannerCount; $b++)
{

echo "singletext[$b]='<table CELLSPACING=\"0\" CELLPADDING=\"0\" align=\"center\"><tr><td height=\"150px\" valign=\"middle\"><a target=\"_blank\" href=\"http://" . $bannerTarget[$b] . "\"><img src='+preload" . $bannerId[$b] . ".src+' width=\"550px\" height=\"100px\" alt=\"\" style=\"border: 0px;\"></a></td></tr></table>';";
}

------End PHP Script-------

-------Script Output-----------

<script type='text/javascript'>var swidth=650;var sheight=150;var sspeed=18;var restart=sspeed;var rspeed=sspeed;var spause=3000;var sbcolor='#cdcd9b';
preload1=new Image();preload1.src='../images/images/steeles_banner.jpg';
preload2=new Image();preload2.src='../images/images/bcd_index_title.gif';
var singletext=new Array();
singletext[0]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td height="150px" valign="middle"><a target="_blank" href="http://www.steelesdrywall.com"><img src='+preload1.src+' width="550px" height="100px" alt="" style="border: 0px;"></a></td></tr></table>';
singletext[1]='<table CELLSPACING="0" CELLPADDING="0" align="center"><tr><td height="150px" valign="middle"><a target="_blank" href="http://www.bcdphotography.com"><img src='+preload2.src+' width="550px" height="100px" alt="" style="border: 0px;"></a></td></tr></table>';

-------End Script Output----------------

Thanks,

Walt