Need Some Design help

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Tariq2009
Forum Newbie
Posts: 3
Joined: Wed Mar 09, 2005 6:22 pm

Need Some Design help

Post by Tariq2009 »

Hi all,
I need some help in table settings I got this script installed on my site and I want all the tables right and left lines to be wide to 1 and I am using Picture for right and left table lines here is the link of site http://www.rt-cards.co.uk/ and the index code is below hope that what I have written is well enough to understand .Thanks

Code: Select all

<?php
/***************************************************************************
*        File Info: index.php
*        Purpose:   Store Home Page
*        Updated:   31/07/2003
****************************************************************************
*        Developer: Alistar Brookbanks (Brooky.com)
*        Copyright: (C)2003 http://www.brooky.com
*        Copyright: (C)2003 http://www.cubecart.com
*        This program is not "free" software and restrictions apply!
*        Further Info: http://www.cubecart.com/license.php
*        Contact support@cubecart.com if any conditions are not clear.
*
*        Licensees holding valid "CubeCart Licence Number" may edit
*        the (powered by CubeCart) from browser title and "Powered by CubeCart"
*        and "(c) Brooky.com" from the web page footer.
*
*        This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING
*        THE WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
*        PURPOSE. This and all others in the download package can only be
*        redistributed with written permission from Alistair Brookbanks!
*
*        The "CubeCart License" is available to purchase at
*        https://secure.cubecart.com/
*        For pricing please contact us via e-mail at sales@cubecart.com
***************************************************************************/

session_start();

include("admin/config.php");

include("admin/settings.inc.php");

include("shoppingcart.php");

include("images/makethumb.txt");

include("affiliate.php");

// warning if install.php has not been deleted
if ((file_exists("$site_dir/install.php"))OR(file_exists("$site_dir/upgrade.php")))
        {
                print "<b><font color='red'>$la_store_security</b>";
                exit;
        }
include("header.inc.php");

$cart = new Cart;

// ********************* Added for affiliate mod ********************** \\

$affil_id = $_GET[affil_id];

if ($nocookies) {
        echo "<tr><td align="center"><table>
        <tr>
                <td align="center" width="500"><b><font size="3">
                Your browser is not accepting cookies.
             Please turn them on or update your browser. You can continue to view this site
             without them on, but they need to be enabled to shop and make a purchase.
             <a href="$_SERVER[PHP_SELF]?cookie=pass"><br /> Click here to Continue without them.</a></font></B>

   </td></tr></table></td></tr>";
           }
else {
           // Rest of the page goes here...


if ($affil_id) {
        if(!$session) {
                $session = $ShoppingCart;
                }
        add_affil($prefix,$affil_id,$session);
        if (($_GET['ckset'] == "ok") AND (!$ShoppingCart))
        {
        add_hit($prefix,$affil_id,$session);
        }
        }
}

// ********************* End Added for affiliate mod ********************** \\

include("subheader.inc.php");

// start border
sb("100%","$date",$colour_1,$bg_colour);

if($cat_format=="b")
        {
                $cat_span=$cat_rows*2;
        }

else
        {
                $cat_span=$cat_rows;
        }

$col_width= 100/$cat_rows;
// if no category is selected display Top_Level categories
include("loyalfront.php");
If (empty($cat_id))
        {
                // welcome note
                echo"<table border="0" width="100%" cellspacing="2" cellpadding="5" align="center">
                                <tr>
                                        <td align="left">$welcome_note</td>
                                </tr>
                </table>";

                echo"<table border="0" width="95%" cellspacing="2" cellpadding="5" align="center">
                                <tr>
                                        <td colspan="$cat_span" align=center class="title1"><strong>$la_store_select_cat</strong></td>
                                </tr>
                                <tr align="center">";

                                $sql_select = mysql_query("SELECT * FROM ".$prefix."store_category where cat_father_id = 0 order by $cat_order");
                                $cat_count = 0;
                                while ($row = mysql_fetch_array($sql_select))
                                        {
                                                $cat_count = $cat_count+1;
                                                $cat_image = $row["cat_image"];
                                                $cat_id_list = $row["cat_id"];
                                                $category = $row["category"];

                                                if($cat_format=="i")
                                                        {
                                                                // image
                                                                echo"<td align="center" width="$col_width%"><a href="index.php?cat_id=$cat_id_list&catname='$category'"><img src='images/$cat_image' alt='$category' border='0'></a>";

                                                        if($cat_count!==$cat_rows)
                                                                {
                                                                        echo"</td>";
                                                                }

                                                        if($cat_count==$cat_rows)
                                                                {
                                                                        echo"</td>
                                                                        </tr>
                                                                        <tr>";
                                                                        $cat_count = 0;
                                                                }
                                                        }

                                                if($cat_format=="t")
                                                        {
                                                                // text
                                                                echo"<td align="center" width="$col_width%"><a href="index.php?cat_id=$cat_id_list&catname='$category'">$category</a>";

                                                                if($cat_count!==$cat_rows)
                                                                {
                                                                        echo"</td>";
                                                                }

                                                        if($cat_count==$cat_rows)
                                                                {
                                                                        echo"</td></tr><tr align="center">";
                                                                        $cat_count = 0;
                                                                }
                                                        }

                                                if($cat_format=="b")
                                                        {
                                                                // text
                                                                echo"<td align="center" width="$col_width_b%" valign="bottom"><a href="index.php?cat_id=$cat_id_list&catname='$category'"><img src='images/$cat_image' alt='$category'  border='0'></a><br><a href="index.php?cat_id=$cat_id_list&catname='$category'">$category</a>";

                                                                if($cat_count!==$cat_rows)
                                                                        {
                                                                                echo"</td>";
                                                                        }

                                                                if($cat_count==$cat_rows)
                                                                        {
                                                                                echo"</td></tr><tr align="center">";
                                                                                $cat_count = 0;
                                                                        }
                                                        }

                                        }
        echo"</tr></table>";
        }

// display if category has been selected
if (!empty($cat_id))
        {
                // create navigation
                require ("link_navi.php");

$sql_select = mysql_query( "SELECT * FROM ".$prefix."store_category where cat_id='$cat_id' order by $cat_order");
        while ($row = mysql_fetch_array($sql_select))
                {
                        $cat_image = $row["cat_image"];
                        $category = $row["category"];
                }

        if (($cat_image!='catnophoto.gif')&&($cat_format!=="t"))
                {
                        echo"</p><img src='images/$cat_image'><br>";
                }


echo "<table border="0" cellspacing="2" width="95%" cellpadding="10" align="center">
                <tr>";
                $sql_select = mysql_query( "SELECT * FROM ".$prefix."store_category where cat_father_id = $cat_id order by $cat_order");
                $more_cat = MYSQL_NUM_ROWS($sql_select);

                while ($row = mysql_fetch_array($sql_select))
                        {
                                $cat_count = $cat_count+1;
                                $cat_image = $row["cat_image"];
                                $cat_id_list = $row["cat_id"];
                                $category = $row["category"];

                                $count_products = mysql_query( "select * from ".$prefix."store_inventory where cat_id='$cat_id_list'");
                                $totalprod = MYSQL_NUM_ROWS($count_products);

                                if($cat_format=="i")
                                        {
                                                // image
                                                echo"<td align="center"><a href="index.php?cat_id=$cat_id_list&catname='$category'"><img src='images/$cat_image' border='0' alt='$category'></a>";

                                        if($cat_count!==$cat_rows)
                                                {
                                                        echo"</td>";
                                                }

                                        if($cat_count==$cat_rows)
                                                {
                                                        echo"</td></tr><tr>";
                                                        $cat_count = 0;
                                                }
                                        }

                                if($cat_format=="t")
                                        {
                                                // text
                                                echo"<td align="center"><a href="index.php?cat_id=$cat_id_list&catname='$category'">$category</a>"; if ($totalprod!==0)
                                                {echo"&nbsp;($totalprod)";}
                                                if($cat_count!==$cat_rows)
                                                        {
                                                                echo"</td>";
                                                        }

                                                if($cat_count==$cat_rows)
                                                        {
                                                                echo"</td></tr><tr align="center">";
                                                                $cat_count = 0;
                                                        }
                                        }

                                if($cat_format=="b")
                                        {
                                                // both
                                                echo"<td align="center"><a href="index.php?cat_id=$cat_id_list&catname='$category'"><img src='images/$cat_image' border='0' alt='$category'></a><br><a href="index.php?cat_id=$cat_id_list&catname='$category'">$category</a>";
                                                if ($totalprod!==0)
                                                {echo"&nbsp;($totalprod)";}

                                                if($cat_count!==$cat_rows)
                                                        {
                                                                echo"</td>";
                                                        }

                                                if($cat_count==$cat_rows)
                                                        {
                                                                echo"</td></tr><tr align="center">";
                                                                $cat_count = 0;
                                                        }
                                        }

                        }
        echo"</tr></table>";


// set limit value for number of records to be shown per page
// query database to find total number of records to display
$limit = $prod_limit;
$query_count = " SELECT * FROM ".$prefix."store_inventory where cat_id='$cat_id' order by $prod_order";
$result_count = mysql_query($query_count);
$totalrows = mysql_num_rows($result_count);
if(empty($page))

$page = 1;

$limitvalue = $page * $limit - ($limit);

$query = "SELECT * FROM ".$prefix."store_inventory where cat_id='$cat_id' order by $prod_order LIMIT $limitvalue, $limit";
$result = mysql_query($query) or die("Error: " . mysql_error());
$count_result = mysql_num_rows($result);

if((mysql_num_rows($result) == 0)and($more_cat==0))
echo("<p align="center"><br>$la_store_no_products</p><br>");

// Display links at the top to indicate current page and number of pages displayed
$numofpages = ceil($totalrows / $limit);

$from=$limit*$page-$limit+1;

$to=$from + $count_result-1;

echo "<table align="center" width="90%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                                <td width="50%" bgcolor="$colour_1" align="left">";if($numofpages>1){echo"$la_store_showing $from - $to</td><td width="50%" bgcolor="$colour_1" align="right"><b>$la_store_go_to_page</b> ($numofpages) ";}

                                $upper_limit = $page + 3;
                                $lower_limit = $page - 2;

                                if($page != 1)
                                        {
                                                $pageprev = $page - 1;
                                                echo("<a href="$PHP_SELF?page=1&cat_id=$cat_id">$la_store_prev</a>&nbsp;");
                                        }

                                $lower_dots = $page - $lowerlimit;

                                if($lower_dots > 3)
                                        {
                                                echo("...");
                                        }

                                for($i = 1; $i <= $numofpages; $i++)
                                        {
                                                if($numofpages>1)
                                                        {
                                                                if($i == $page)
                                                                        {
                                                                                echo("&nbsp;<b>[".$i."]</b>&nbsp;");
                                                                        }

                                                                if(($i != $page)&&($i < $upper_limit)&&($i >= $lower_limit))
                                                                        {
                                                                                echo("&nbsp;<a href="$PHP_SELF?page=$i&cat_id=$cat_id">$i</a>&nbsp;");
                                                                        }
                                                        }
                                        }

                                $upper_dots = $numofpages - 2;

                                if($page < $upper_dots)
                                        {
                                                echo("...&nbsp;");
                                        }

                                if(($totalrows - ($limit * $page)) > 0)
                                        {
                                                $pagenext = $page + 1;
                                                echo("&nbsp;<a href="$PHP_SELF?page=$numofpages&cat_id=$cat_id">$la_store_next</a>");
                                        }
                                echo"</tr>
                        </td>
                </table>";

// display products if there are any
if($totalrows>0)
        {
                echo"<br><table align="center" valign="top" width="90%" border="0" cellspacing="0" cellpadding="0">
                                        <tr bgcolor="$colour_2">
                                                <td>
                                                        <table cellpadding="2" border="0" cellspacing="1" valign="top" width="100%" align="center">
                                                                <tr bgcolor="$colour_1" height="20" width="100%">
                                                                        <td background="images/bevel_bg.gif" align="center"><b>$la_store_image</b></td>
                                                                        <td background="images/bevel_bg.gif" align="center"><b>$la_store_title</b></td>
                                                                        <td background="images/bevel_bg.gif" align="center"><b>$la_store_description</b></td>
                                                                        <td background="images/bevel_bg.gif" align="center"><b>$la_store_price</b></td>
                                                                        <td background="images/bevel_bg.gif">&nbsp;</td>
                                                                </tr>";
        }
                                                        $bgcolour=$colour_4;
                                                        while($row = mysql_fetch_array($result))
                                                                {
                                                                        $product=$row["product"];
                                                                        $description= $row["description"];
                                                                        $price=$row["price"];
                                                                        $sale_price=$row["sale_price"];
                                                                        $image=$row["image"];
                                                                        $title=$row["title"];
                                                                        $title=stripslashes($title);
                                                                        $description=stripslashes($description);
                                                                        $description=substr($description,0,100);

                                                                        if ($bgcolour ==$colour_3)
                                                                                {
                                                                                        $bgcolour =$colour_4;
                                                                                }
                                                                        elseif ($bgcolour ==$colour_4)
                                                                                {
                                                                                        $bgcolour =$colour_3;
                                                                                }

                                                                        if (!file_exists("$site_dir/images/" . "thumb_$image"))
                                                                                {
                                                                                        $thumb=new thumbnail("$site_dir/images/$image");
                                                                                        $thumb->size_auto(75);
                                                                                        $thumb->jpeg_quality(75);
                                                                                        $thumb->save("$site_dir/images/thumb_$image", $gd_version);
                                                                                }

                                                        echo"<tr bgcolor="$bgcolour">";
                                                                        if($gd_version!==0){
                                                                        echo"<td bgcolor="$bgcolour" align="center"><a href="view_product.php?product=$product"><img src="images/thumb_$image" border="0"></a></td>";}
                                                                        else{
                                                                        echo"<td bgcolor="$bgcolour" align="center"><a href="view_product.php?product=$product"><img src="images/$image" width="75" height="75" border="0"></a></td>";}

                                                                        echo"<td align="center"><a href="view_product.php?product=$product">$title</a></td>
                                                                        <td>$description";
                                                                                if(strlen($description)>=100)
                                                                                        {
                                                                                                echo"..";
                                                                                        }
                                                                if(empty($description))
                                                                        {
                                                                                echo"n/a";
                                                                        }
                                                                        echo"</td>
                                                                        <td align="center">";

                                                                if(($sale=="Y")and($sale_price!=="0.00"))
                                                                        {
                                                                                echo"$currency<s>$price</s>";
                                                                                echo"<br>$currency<font color="#990000">$sale_price</font>";
                                                                        }

                                                                if(($sale=="Y")and($sale_price=="0.00"))
                                                                        {
                                                                                echo"<br>$currency$price";
                                                                        }

                                                                if($sale=="N")
                                                                        {
                                                                                echo"$currency$price";
                                                                        }
                                                                echo"</td>
                                                                <td align="center" valign="middle" height="48" width="94">
                                                                        <table width="94" height="24" border="0" cellpadding="0" cellspacing="0">
                                                                                <tr>
                                                                                        <td height="24" width="94" background="images/white_button.gif" align="center" valign="middle" style="cursor: hand;" onClick="location.href='view_product.php?product=$product'"><a href="view_product.php?product=$product"><font class="wht_btn">$la_more_info</font></a></td>
                                                                                </tr>
                                                                        </table>
                                                                </td>
                                                        </tr>";
                                                }

                                                if($totalrows>0)
                                                        {
                                                                echo"</td>
                                                                </tr>
                                                        </table>
                                                </td>
                                        </tr>
                                </table><br>";
                        }


// Display links at the bottom to indicate current page and number of pages displayed
echo "<table align="center" width="90%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                        <td bgcolor="$colour_1" align="right">";if($numofpages>1){echo"<b>$la_store_go_to_page</b> ($numofpages) ";}

                        $upper_limit = $page + 3;
                        $lower_limit = $page - 2;

                        if($page != 1)
                                {
                                        $pageprev = $page - 1;
                                        echo("<a href="$PHP_SELF?page=1&cat_id=$cat_id">$la_store_prev</a>&nbsp;");
                                }

                        $lower_dots = $page - $lowerlimit;

                        if($lower_dots > 3)
                                {
                                        echo("...");
                                }

                        for($i = 1; $i <= $numofpages; $i++)
                                {
                                        if($numofpages>1)
                                                {
                                                        if($i == $page)
                                                                {
                                                                        echo("&nbsp;<b>[".$i."]</b>&nbsp;");
                                                                }

                                                        if(($i != $page)&&($i < $upper_limit)&&($i >= $lower_limit))
                                                                {
                                                                        echo("&nbsp;<a href="$PHP_SELF?page=$i&cat_id=$cat_id">$i</a>&nbsp;");
                                                                }
                                                }
                                }

                        $upper_dots = $numofpages - 2;

                        if($page < $upper_dots)
                                {
                                        echo("...&nbsp;");
                                }

                        if(($totalrows - ($limit * $page)) > 0)
                                {
                                        $pagenext = $page + 1;
                                        echo("&nbsp;<a href="$PHP_SELF?page=$numofpages&cat_id=$cat_id">$la_store_next</a>");
                                }
                        else

                        mysql_free_result($result);

                        echo"</td>
                </tr>
        </table><br><br>";
}
// end border

eb($bg_colour,$colour_1);
// include product spotlight is enabled

include("subfooter.inc.php");

include( "footer.inc.php");

?>
PHENOM | please use

Code: Select all

tags around your code[/color]
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Moved to PHP-Code
Last edited by John Cartwright on Thu Mar 10, 2005 6:44 am, edited 1 time in total.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I don't understand what you are trying to do.. although I do see plenty of code errors. Unquoted named array indices being one, unescaped double quotes in a double quote string, being at least another.
Tariq2009
Forum Newbie
Posts: 3
Joined: Wed Mar 09, 2005 6:22 pm

Post by Tariq2009 »

Thanks PHENOM for moving to right place :D
Hi feyd what i am trying to do is that i want to cahnge the look of my site design and table width to be 1 so it look like a thin line now it is showing a wide line as you can see it at http://www.rt-cards.co.uk/
Thanks
zenabi
Forum Commoner
Posts: 84
Joined: Mon Sep 08, 2003 5:26 am
Location: UK

Post by zenabi »

So you want the table borders to be only 1px wide? I had a quick look at the HTML code that gets produced and it seems your borders are actually table cells. Look for where your PHP script outputs lines containing the following:

Code: Select all

<td background=&quote;images/ml.gif&quote; width=&quote;8&quote;>&nbsp;</td>
and change the width attribute to 1px.
Tariq2009
Forum Newbie
Posts: 3
Joined: Wed Mar 09, 2005 6:22 pm

Post by Tariq2009 »

zenabi wrote:So you want the table borders to be only 1px wide? I had a quick look at the HTML code that gets produced and it seems your borders are actually table cells. Look for where your PHP script outputs lines containing the following:

Code: Select all

<td background=&quote;images/ml.gif&quote; width=&quote;8&quote;>&nbsp;</td>
and change the width attribute to 1px.
Hi i made that change but still same nothing is changing
Thanks
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

Traiq2009 seems to be right. This is my opinion too.

Going to your site and viewing your HTML it seems that you just need to go through the code changing all the widths/heights of the 8px columns with Background images to 1px like this

Code: Select all

<td background=&quote;images/ml.gif&quote; width=&quote;8&quote;>&nbsp;</td>

Should be......

<td background=&quote;images/ml.gif&quote; width=&quote;1&quote;>&nbsp;</td>
There will be parts like this all over the document that need changing but that looks like it to me ;-)
Post Reply