Tom Muck

Alpha Dog Blues Band
Home page
All articles
All Extensions | Extension News | Extension FAQs | Customer Login
Books authored or co-authored by Tom Muck
Extensions, books, and other products | Customer Login
Your current cart contents
Tom-Muck.com Blog | CMXTraneous Blog | Flash Remoting Blog
About the site

Horizontal Looper Code

Add Horizontal Looper code to Results

To add a horizontal looper code to the results page, you could use the following modification. The table on CWIncResults.php between lines 81 and 114 can be removed and replaced with the following:

<table class="tabularData" id="tableSearchResults">
  <tr>
<?php
$row_rsCWResults = $cartweaver->db->db_fetch_assoc($rsCWResults);
$recCounter = 0;
$rsCWResults_endRow = 0;
$rsCWResults_columns = 3; // number of columns
$rsCWResults_hloopRow1 = 0; // first row flag
do {
    if($rsCWResults_endRow == 0  && $rsCWResults_hloopRow1++ != 0) echo
"<tr>";
   ?>
    <td style="width:30%">
    <?php
    $tempProdId = $row_rsCWResults["product_ID"];
    $rsCWThumbnail_query = "SELECT prdctImage_FileName
    FROM tbl_prdtimages
    WHERE prdctImage_ProductID = $tempProdId
    AND    prdctImage_ImgTypeID = 1";
    $rsCWThumbnail = $cartweaver->db->executeQuery($rsCWThumbnail_query);
    $row_rsCWThumbnail = $cartweaver->db->db_fetch_assoc($rsCWThumbnail);
    $imageSRC = $imageRoot . $row_rsCWThumbnail["prdctImage_FileName"];
    $imagePath = expandPath($imageSRC);
    ?><p><strong><?php
echo($row_rsCWResults["product_Name"]);?></strong><br>
            <?php echo($row_rsCWResults["product_ShortDescription"]);?></p>
            <?php
                if (file_exists($imagePath) && is_file($imagePath)) { ?>
                    <a href="<?php
echo($cartweaver->settings->targetDetails . "?prodId=" .
$row_rsCWResults["product_ID"] . "&category=" . $urlcategory) ?>"><img
src="<?php echo($imageSRC) ?>" alt="<?php
echo($row_rsCWResults["product_Name"]) ?>" border="0"></a>
                <?php }else{ ?>No Image Available
                <?php } ?>
                <p><a href="<?php
echo($cartweaver->settings->targetDetails . "?prodId=" .
$row_rsCWResults["product_ID"] . "&category=" . $urlcategory)
?>">Details</a></p></td>
<?php  $rsCWResults_endRow++;
if($rsCWResults_endRow >= $rsCWResults_columns) {
  ?>
</tr>
 <?php
 $rsCWResults_endRow = 0;
  }
} while ($row_rsCWResults = $cartweaver->db->db_fetch_assoc($rsCWResults));
if($rsCWResults_endRow != 0) {
while ($rsCWResults_endRow < $rsCWResults_columns) {
    echo("<td>&nbsp;</td>");
    $rsCWResults_endRow++;
}
echo("</tr>");
}?>
</table>

Back to Cartweaver PHP FAQ, code changes, and samples

Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
Pay me securely with your Visa, MasterCard, Discover, or American Express card through PayPal!
About | Privacy Policy | Contact | License Agreement | ©2002-2025 Tom Muck | Dreamweaver Extensions