Jump to content

Help: rollover nagivation populated by database


aussie

Recommended Posts

Hi,

I am trying to convert my old site originally created in 1997 from html /javascript to javascript/php with data populated from my existing database.

I have googled and researched for 2 months now but found nothing to help. I tried converting it a couple of years ago but was able to find nothing.

 

My site has stars when the mouse hovers over a star it glows and and shows a thumbnail image.

the glowing star is clicked on and then takes you to the view product page.

Easier to see than to describe: http://www.fairiesnfantasy.com

 

12 images appear on each product listing page.

 

My script.js contains: (I haven't included the whole 12 as it just repeats)

 

//preload images:

{

        pic1 = new Image(197,268);

        pic1.src = "images/fairies_sisters_th.jpg";

        pic2 = new Image(197,268);

        pic2.src = "images/mountain_magic_fairies_th.jpg"; etc.,

 

  a1 = new Image(63,61);

        a1.src = "images/fairystar1.gif";

        a2 = new Image(63,61);

        a2.src = "images/fairystar_glow1.gif";

        b1 = new Image(63,61);

        b1.src = "images/fairystar1.gif";

        b2 = new Image(63,61);

        b2.src = "images/fairystar_glow1.gif";

 

This is the code which I think needs to be changed to call on the database

my html page contains

 

<a href="fairy_sisters.php"

        onmouseover="hiLite('pic','pic1','a','a2')"

        onmouseout="hiLite('pic','pic1','a','a1')"><font size="5"><img

        src="images/fairystar1.gif" border="0" width="63" height="61"

        name="a"></font></a><a href="fairy_mountain_magic.php" onmouseover="hiLite('pic','pic2','b','b2')"

        onmouseout="hiLite('pic','pic2','b','b1')"><font size="5"><img

        src="images/fairystar2.gif" border="0" width="63" height="61"

        name="b"></font></a>

 

My php code I am trying to adapt is from my shopping cart site. Which I have .htaccess for sef urls

I understand that not all of the code below will apply.

Code:

 

$productsPerRow = 6;

$productsPerPage = 12;

 

//$productList    = getProductList($catId);

$children = array_merge(array($catId), getChildCategories(NULL, $catId));

$children = ' (' . implode(', ', $children) . ')';

 

$sql = "SELECT pd_id, pd_name, pd_file_name, pd_price, pd_size, pd_thumbnail, pd_qty, c.cat_id

FROM tbl_product pd, tbl_category c

WHERE pd.cat_id = c.cat_id AND pd.cat_id IN $children

ORDER BY pd_id DESC";

$result    = dbQuery(getPagingQuery($sql, $productsPerPage));

$pagingLink = getPagingLink($sql, $productsPerPage, "c=$catId");

$numProduct = dbNumRows($result);

 

// the product images are arranged in a table. to make sure

// each image gets equal space set the cell width here

$columnWidth = (int)(100 / $productsPerRow);

 

if ($numProduct > 0 ) {

 

$i = 0;

while ($row = dbFetchAssoc($result)) {

 

extract($row);

if ($pd_thumbnail) {

$pd_thumbnail = WEB_ROOT . 'images/product/' . $pd_thumbnail;

} else {

$pd_thumbnail = WEB_ROOT . 'images/no-image-small.png';

}

 

if ($i % $productsPerRow == 0) {

echo '<tr>';

}

 

 

echo "<td width=\"$pd_thumbnail\" align=\"center\">

<a href=\" fantasy-art/$cat_id/$pd_id/$pd_file_name.html\"><img src=\"$pd_thumbnail\" border=\"0\"><BR><BR></td>

<td></a><br><strong><a href=\" fantasy-art/$cat_id/$pd_id/$pd_file_name.html\">$pd_name</strong></a>

<br><br><br><br><a href=\" fantasy-art/$cat_id/$pd_id/$pd_file_name.html\"><b><FONT COLOR=\"#FF0000\">More Details»</FONT></b><BR><BR>

</a> ";

 

// product out of stock

if ($pd_qty <= 0) {

echo "Status: <br><B><FONT COLOR=\"#FF0000\">SOLD OUT</FONT></B>";

}

 

echo "</td>\r\n";

 

if ($i % $productsPerRow == $productsPerRow - 1) {

echo '</tr>';

}

 

$i += 1;

}

 

if ($i % $productsPerRow > 0) {

echo '<td colspan="' . ($productsPerRow - ($i % $productsPerRow)) . '"> </td>';

}

 

} else {

 

I understand javascript enough to edit it a little. My php learning has been 6 years on a need to know.

I hope the information provided it enough!

 

I also hope it is possible with some gurus help.

 

 

 

 

 

Sorry I guess I had no replies because I forgot to put the code in the code box.

Shall try again. (First time I've posted here and first time I've ever post code)

 

My script.js contains: (I haven't included the whole 12 as it just repeats)

//preload images:
{
        pic1 = new Image(197,268);
        pic1.src = "images/fairies_sisters_th.jpg";
        pic2 = new Image(197,268);
        pic2.src = "images/mountain_magic_fairies_th.jpg"; etc.,

  a1 = new Image(63,61);
        a1.src = "images/fairystar1.gif";
        a2 = new Image(63,61);
        a2.src = "images/fairystar_glow1.gif";
        b1 = new Image(63,61);
        b1.src = "images/fairystar1.gif";
        b2 = new Image(63,61);
        b2.src = "images/fairystar_glow1.gif";

This is the code which I think needs to be changed to call on the database
my html page contains

<a href="fairy_sisters.php"
        onmouseover="hiLite('pic','pic1','a','a2')"
        onmouseout="hiLite('pic','pic1','a','a1')"><font size="5"><img
        src="images/fairystar1.gif" border="0" width="63" height="61"
        name="a"></font>[/url]<a href="fairy_mountain_magic.php" onmouseover="hiLite('pic','pic2','b','b2')"
        onmouseout="hiLite('pic','pic2','b','b1')"><font size="5"><img
        src="images/fairystar2.gif" border="0" width="63" height="61"
        name="b"></font>[/url]

Thankyou,

 

Here's the php code I'm trying to adapt to be able to use the javascript rollover example in my previous post.

If I can get help with how to to incorporate getting the urls from the database for the product listing pages I can fix the rest myself.

 

 

$productsPerRow = 6;
$productsPerPage = 12;

//$productList    = getProductList($catId);
$children = array_merge(array($catId), getChildCategories(NULL, $catId));
$children = ' (' . implode(', ', $children) . ')';

$sql = "SELECT pd_id, pd_name, pd_file_name, pd_price, pd_size, pd_thumbnail, pd_qty, c.cat_id
      FROM tbl_product pd, tbl_category c
      WHERE pd.cat_id = c.cat_id AND pd.cat_id IN $children
      ORDER BY pd_id DESC";
$result     = dbQuery(getPagingQuery($sql, $productsPerPage));
$pagingLink = getPagingLink($sql, $productsPerPage, "c=$catId");
$numProduct = dbNumRows($result);

// the product images are arranged in a table. to make sure
// each image gets equal space set the cell width here
$columnWidth = (int)(100 / $productsPerRow);

if ($numProduct > 0 ) {

   $i = 0;
   while ($row = dbFetchAssoc($result)) {
   
      extract($row);
      if ($pd_thumbnail) {
         $pd_thumbnail = WEB_ROOT . 'images/product/' . $pd_thumbnail;
      } else {
         $pd_thumbnail = WEB_ROOT . 'images/no-image-small.png';
      }
   
      if ($i % $productsPerRow == 0) {
         echo '<tr>';
      }

      
      echo "<td width=\"$pd_thumbnail\" align=\"center\">
      <a href=\" fantasy-art/$cat_id/$pd_id/$pd_file_name.html\"><img src=\"$pd_thumbnail\" border=\"0\"><BR><BR></td>
<td>[/url]
<strong><a href=\" fantasy-art/$cat_id/$pd_id/$pd_file_name.html\">$pd_name</strong>[/url]




<a href=\" fantasy-art/$cat_id/$pd_id/$pd_file_name.html\"><FONT COLOR=\"#FF0000\">More Details»</FONT><BR><BR>
[/url] ";

      // product out of stock
      if ($pd_qty <= 0) {
         echo "Status:
<B><FONT COLOR=\"#FF0000\">SOLD OUT</FONT></B>";
      }
      
      echo "</td>\r\n";
   
      if ($i % $productsPerRow == $productsPerRow - 1) {
         echo '</tr>';
      }
      
      $i += 1;
   }
   
   if ($i % $productsPerRow > 0) {
      echo '<td colspan="' . ($productsPerRow - ($i % $productsPerRow)) . '"> </td>';
   }
   
} else {

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.