p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   PHP How-To (http://p2p.wrox.com/forumdisplay.php?f=98)
-   -   PHP Styling (http://p2p.wrox.com/showthread.php?t=56264)

adaniels11 April 4th, 2007 02:38 PM

PHP Styling
Hi, I'm fairly new at PHP and am in the process of creating an online shop complete with shopping cart. I have put some code together which lists all my categories in a "menu" type way but I would like to know how to sytle these links as they look bland and not as good as my plain html ones. Also, when the category is clicked, I am trying to get it to load a picture as well as giving description and price. At present I only get description and price and no picture but I can't see why. The piece of code is:

                $get_cats = "select id, cat_desc from Category order by id";
$get_cats_res = mysql_query($get_cats) or die(mysql_error());

if (mysql_num_rows($get_cats_res) < 1) {
   $display_block = "<P><em>Sorry, no categories to browse.</em></p>";
} else {
   while ($cats = mysql_fetch_array($get_cats_res)) {
        $cat_id = $cats[id];
        $cat_desc = stripslashes($cats[cat_desc]);

        $menu_block .= "<p><strong><a href=\"$_SERVER[PHP_SELF]?cat_id=$cat_id\">$cat_desc</a></strong></p>";

        if ($_GET[cat_id] == $cat_id) {
           //get Product
           $get_Product = "select id, item_slogan, item_price, item_image from Product where cat_id = $cat_id order by item_slogan";
           $get_Product_res = mysql_query($get_Product) or die(mysql_error());

           if (mysql_num_rows($get_Product_res) < 1) {
                $display_block = "<P><em>Sorry, no items in this category.</em></p>";
           } else {
                $display_block .= "[list]";

                while ($Product = mysql_fetch_array($get_Product_res)) {
                   $item_id = $Product[id];
                   $item_slogan = stripslashes($Product[item_slogan]);
                   $item_price = $Product[item_price];
                   $item_image = $Product[item_image];

                   $display_block .= "<li><a href=\"showitem.php?item_id=$item_id\">$item_sloga n</a></strong> (£$item_price)";

                $display_block .= "</ul>";
Does any one have any ideas please?

Thank you.

Dj Kat April 10th, 2007 05:10 AM

Not sure what you mean but I think you want to style the hyperlink tags

<a href="http://www.somesite.com">some site</a>
If this is what you want to style you should use CSS.
The same goes for list styles

__________________________________________________ ________
I am DJ Kat...that's my name. Its a D and a J and a Kat with a K.

All times are GMT -4. The time now is 11:15 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.