Tazzeh
10-24-2010, 02:11 AM
1) Script Title: Step Carousel Viewer 1.9
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm
3) Describe problem:
I have integrated a step carousel so that when a drop down box is changed, a javascript is run that passes data to a php file, which generates an html file for use within the carousel, which then updates. As confusing as that sounds i'll provide code shortly.
My problem is that once this data is loaded, the carousel refuses to move. The left and right buttons are clickable and indeed grey out when they deem themselves to have reached the end of the list, but the carousel itself doesn't move. I've found this a great versatile script thus far and would like to continue using it so some help would be great!!
Here's my code for reference:
index.php -
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="stepcarousel.js"> /* Carousel Script Link With Legal Crap */
/***********************************************
* Step Carousel Viewer script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>
<script type="text/javascript"> /* Carousel Settings Script */
stepcarousel.setup(
{
galleryid: 'conveyor', //id of carousel DIV
beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
panelclass: 'panel', //class of panel DIVs each holding content
autostep: {enable:false},
panelbehavior: {speed:300, wraparound:false, wrapbehavior:'pushpull', persist:false},
defaultbuttons: {enable: true, moveby: 1, leftnav: ['./images/conveyorback.gif', 0, 155], rightnav: ['./images/conveyorforward.gif', -50, 155]},
contenttype: ['ajax','conveyordata.html'] //content setting ['inline'] or ['ajax', 'path_to_external_file']
}
)
</script>
<script type="text/javascript">
function jsupdateproducts()
{
xmlhttp=new XMLHttpRequest();
var catvalue = document.filterform.categoryselect.selectedIndex;
var cat = document.filterform.categoryselect.options[catvalue].text;
xmlhttp.open("GET","updateproducts.php?cat="+cat,true);
xmlhttp.send();
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
stepcarousel.loadcontent('conveyor', 'conveyordata.html')
}
}
}
</script>
</head>
<body onload="jsupdateproducts()">
<?php
//CONNECT TO SERVER
$con = mysql_connect ('localhost', '*****', '*****');
if (!$con)
{
die('Could not connect to products database - ' . mysql_error());
}
//SELECT DATABASE
$select = mysql_select_db('mattbyrn_LMCProd', $con);
?>
<form name="filterform" action="./index.php" onchange="jsupdateproducts()">
<table id="filtertable">
<tr>
<td>
<select name="categoryselect">
<option value="All" selected="selected">All</option>
<?php
$query = mysql_query("SELECT DISTINCT category FROM Product");
if(!$query)
{
die('Could not get category list - ' . mysql_error());
}
else
{
while($row = mysql_fetch_array($query))
{
echo("<option value=\"".$row['category']."\">".$row['category']."</option>");
}
}
?>
</select>
</td>
</tr>
</table>
</form>
<div id="conveyor" class="stepcarousel">
<div class="belt">
<!-- Javascript generated panels go here -->
</div>
</div>
</body>
</html>
updateproducts.php -
<?php
$cat = $_REQUEST['cat'];
$file = "conveyordata.html";
print($cat);
//CONNECT TO SERVER
$con = mysql_connect ('localhost', '******', '******');
if (!$con)
{
die('Could not connect to products database - ' . mysql_error());
}
//SELECT DATABASE
$select = mysql_select_db('mattbyrn_LMCProd', $con);
if($cat=="All")
{
$query = mysql_query("SELECT * FROM Product");
}
else
{
$query = mysql_query("SELECT * FROM Product WHERE category = '".$cat."'");
}
if(!$query)
{
die('Could not get product list - ' . mysql_error());
}
else
{
$fh = fopen($file, 'w') or die("can't open file");
while($row = mysql_fetch_array($query))
{
fwrite($fh, "<div class=\"panel\">");
fwrite($fh, $row['manufacturer']);
fwrite($fh, "<br />");
fwrite($fh, $row['name']);
fwrite($fh, "<br />");
fwrite($fh, "$".$row['price']);
fwrite($fh, "</div>");
}
fclose($fh);
}
?>
It's really confusing me, and I feel it's probably something really simple and stupid that i'm missing. Thanks in advance!
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/stepcarousel.htm
3) Describe problem:
I have integrated a step carousel so that when a drop down box is changed, a javascript is run that passes data to a php file, which generates an html file for use within the carousel, which then updates. As confusing as that sounds i'll provide code shortly.
My problem is that once this data is loaded, the carousel refuses to move. The left and right buttons are clickable and indeed grey out when they deem themselves to have reached the end of the list, but the carousel itself doesn't move. I've found this a great versatile script thus far and would like to continue using it so some help would be great!!
Here's my code for reference:
index.php -
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="stepcarousel.js"> /* Carousel Script Link With Legal Crap */
/***********************************************
* Step Carousel Viewer script- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
* Visit http://www.dynamicDrive.com for hundreds of DHTML scripts
* This notice must stay intact for legal use
***********************************************/
</script>
<script type="text/javascript"> /* Carousel Settings Script */
stepcarousel.setup(
{
galleryid: 'conveyor', //id of carousel DIV
beltclass: 'belt', //class of inner "belt" DIV containing all the panel DIVs
panelclass: 'panel', //class of panel DIVs each holding content
autostep: {enable:false},
panelbehavior: {speed:300, wraparound:false, wrapbehavior:'pushpull', persist:false},
defaultbuttons: {enable: true, moveby: 1, leftnav: ['./images/conveyorback.gif', 0, 155], rightnav: ['./images/conveyorforward.gif', -50, 155]},
contenttype: ['ajax','conveyordata.html'] //content setting ['inline'] or ['ajax', 'path_to_external_file']
}
)
</script>
<script type="text/javascript">
function jsupdateproducts()
{
xmlhttp=new XMLHttpRequest();
var catvalue = document.filterform.categoryselect.selectedIndex;
var cat = document.filterform.categoryselect.options[catvalue].text;
xmlhttp.open("GET","updateproducts.php?cat="+cat,true);
xmlhttp.send();
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
stepcarousel.loadcontent('conveyor', 'conveyordata.html')
}
}
}
</script>
</head>
<body onload="jsupdateproducts()">
<?php
//CONNECT TO SERVER
$con = mysql_connect ('localhost', '*****', '*****');
if (!$con)
{
die('Could not connect to products database - ' . mysql_error());
}
//SELECT DATABASE
$select = mysql_select_db('mattbyrn_LMCProd', $con);
?>
<form name="filterform" action="./index.php" onchange="jsupdateproducts()">
<table id="filtertable">
<tr>
<td>
<select name="categoryselect">
<option value="All" selected="selected">All</option>
<?php
$query = mysql_query("SELECT DISTINCT category FROM Product");
if(!$query)
{
die('Could not get category list - ' . mysql_error());
}
else
{
while($row = mysql_fetch_array($query))
{
echo("<option value=\"".$row['category']."\">".$row['category']."</option>");
}
}
?>
</select>
</td>
</tr>
</table>
</form>
<div id="conveyor" class="stepcarousel">
<div class="belt">
<!-- Javascript generated panels go here -->
</div>
</div>
</body>
</html>
updateproducts.php -
<?php
$cat = $_REQUEST['cat'];
$file = "conveyordata.html";
print($cat);
//CONNECT TO SERVER
$con = mysql_connect ('localhost', '******', '******');
if (!$con)
{
die('Could not connect to products database - ' . mysql_error());
}
//SELECT DATABASE
$select = mysql_select_db('mattbyrn_LMCProd', $con);
if($cat=="All")
{
$query = mysql_query("SELECT * FROM Product");
}
else
{
$query = mysql_query("SELECT * FROM Product WHERE category = '".$cat."'");
}
if(!$query)
{
die('Could not get product list - ' . mysql_error());
}
else
{
$fh = fopen($file, 'w') or die("can't open file");
while($row = mysql_fetch_array($query))
{
fwrite($fh, "<div class=\"panel\">");
fwrite($fh, $row['manufacturer']);
fwrite($fh, "<br />");
fwrite($fh, $row['name']);
fwrite($fh, "<br />");
fwrite($fh, "$".$row['price']);
fwrite($fh, "</div>");
}
fclose($fh);
}
?>
It's really confusing me, and I feel it's probably something really simple and stupid that i'm missing. Thanks in advance!