Jump to content

 

ursula1000

Member Since 04 Dec 2006
Offline Last Active Mar 06 2007 02:28 PM
-----

Topics I've Started

Javascript with PHP code in .tpl file

04 December 2006 - 02:41 PM

How to include in template file javascript code like this:

<script language="JavaScript" type="text/javascript">
var i=0;
galleryConfig.images = new Array();
<?php
$product_id = $_GET['product_id'];
$link = mysql_connect("xxxx","xxxx","xxxx");
mysql_select_db("xxxx");
$query = "SELECT * FROM cscart_product_images_links WHERE product_id =" . $product_id . "";
$results = mysql_query($query);
while($row = mysql_fetch_assoc($results)) {?>
galleryConfig.images[i] = {full:"image.php?object_type=product&image_id=<?php echo $row['image_id']; ?>", thumb: "image.php?object_type=product&image_id=<?php echo $row['image_id']; ?>" };
i++;
<?php } ?>
</script>