...

View Full Version : Hw Do I Change This Code?



Byronwells
01-09-2010, 07:42 PM
Alright Guys I have this following code:



// catagory list
function categories($db_domain)
{
include "common/config.php";

$query = "SELECT * FROM ".$prefix."category";
$result = mysql_query($query);
$admin_ads_top = "<br><table cellSpacing=0 cellPadding=5 align=center border=0><tr>";
$kk=0;
while ($row = mysql_fetch_array($result, MYSQL_NUM))
{
$kk++;
$tr=$etr=NULL;

$tr="</tr><tr>";



$cat_title=$row[1];
// Count how many products in this catagory

$qry="select count(*) as cnt from ".$prefix."products where category='$cat_title'";
$presult = $db_domain->get_a_line($qry);
$pcount=$presult[cnt];



$link = $cat_title;
$link = preg_replace('/([^a-z0-9])+/i', '_', $cat_title);
$starttable="$tr<td width=33% class=tbtext align=left valign=top>";
$endtable = "</td>";
$admin_ads_top.="$starttable <a href=marketplace.php?cat=t&category=$link><font color=#0000FF>$cat_title</font></a> ($pcount)$endtable";
$tr=$etr=NULL;
}
$admin_ads_top.="</tr><tr><td>&nbsp;</td></tr></table>";
return $admin_ads_top;
}
//=====================================================================================


That code allows me to display the catgeroies from a database on this site http://www.digitalresellersvault.com/marketplace.php on the left hand side in the categories box.. Those are the ones in the dark blue..


However I need to change that above code so that I can have them display just like the ones that I had added manually in light blue..

The css code for that section is as follows:




/************************************************

* Left Sidebar *

************************************************/



#l_sidebar {

float: left;

width: 175px;

margin: 0px 0px 0px 10px;

padding: 0px;

line-height: 20px;

display: inline;

}


#l_sidebar p {

padding: 0px;

margin: 0px;

}



#l_sidebar a img {

border: none;

margin: 0px;

padding: 0px;

}



#l_sidebar h2 {


height: 45px;

color: #f9ea45;

font-size: 12px;

font-family: Verdana;

font-weight: bold;

margin: 0px 0px 10px 0px;

padding: 1px 0px 1px 5px;

line-height: 42px;

}



#l_sidebar h3 {

color: #006699;

font-size: 18px;

font-family: Times New Roman, Tahoma, Verdana;

font-weight: normal;

margin: 0px 0px 5px 0px;

padding: 0px;

line-height: 20px;

}

#l_sidebar ul {
list-style: none;
margin: 0;
padding: 0; }

#l_sidebar li {
background: url(images/bulletback.jpg) no-repeat left;
}

#l_sidebar li a, #l_sidebar li a:visited {
color: #359CBB;
text-decoration: none;
margin: 0 0 0 20px;
}


.leftboxheader {

background: #FFFFFF;

float: left;

width: 175px;

height: 33px;

margin: 0px 0px 0px 0px;

padding: 0px 0px 0px 0px;


}


.leftbox {

background: #FFFFFF;

float: left;

width: 171px;

margin: 0px 0px 0px 0px;

padding: 10px 0px 0px 0px;

border-left: 2px solid #9B9B9B;

border-right: 2px solid #9B9B9B;

font-size: 11px;

font-family: Tahoma;

font-weight: Bold;

color: #359CBB;


}

.leftbottom {

background: #FFFFFF url(images/borderbottom.jpg) no-repeat;

float: left;

width: 175px;

height: 10px;

margin: 0px 0px 0px 0px;

padding: 0px 0px 10px 0px;


}





Can anyone help please?

tomws
01-09-2010, 08:27 PM
Remove the table html and replace it with li tags.

Byronwells
01-10-2010, 01:04 AM
Remove the table html and replace it with li tags.

Tom

Do I need To Take Stuff out like this $starttable ?

tomws
01-10-2010, 01:22 AM
That's one of the places. More above. More below. Just the table-related html. Then replace with list items. I think the current code already has the anchor tags set up for you.

Byronwells
01-10-2010, 08:02 PM
That's one of the places. More above. More below. Just the table-related html. Then replace with list items. I think the current code already has the anchor tags set up for you.

Tom

I beleive I have taken out all the tables part.. I have got the categories now to look like the ones underneath.. However the color is not the same as yet..

By any chance this code has something to do with it?



$admin_ads_top.="$starttable <a href=marketplace.php?cat=t&category=$link><font color=#0000FF>$cat_title</font></a> ($pcount)$endtable";

tomws
01-10-2010, 11:28 PM
That's probably it. 0000ff is blue. You can change the hex color code there. It would probably be better to remove the wrapping font tag completely and just let the existing CSS style apply.

Byronwells
01-11-2010, 01:22 AM
That's probably it. 0000ff is blue. You can change the hex color code there. It would probably be better to remove the wrapping font tag completely and just let the existing CSS style apply.

Tom

Sorry to keep being a pain.. But by any chance, can you tell what the product count is link to in the css?? I cant figure it out.. I can find out which part it is the above code, but not.. I have been through all css files and cant find the colour #359CBB

So I am really confused

tomws
01-11-2010, 03:02 AM
Looking good. Almost there.

It has inline style applied through a font tag and is using a color different than 359CBB. Check the page source to see. It's also being wrapped incorrectly:

<font color= #C91401>(0)</li></font>
The list item tag is closed before the font tag. That will break some things.

I can't tell where that's coming from in the code in the original post. Can you paste in the current categories function code?

Byronwells
01-11-2010, 03:41 AM
Looking good. Almost there.

It has inline style applied through a font tag and is using a color different than 359CBB. Check the page source to see. It's also being wrapped incorrectly:

<font color= #C91401>(0)</li></font>
The list item tag is closed before the font tag. That will break some things.

I can't tell where that's coming from in the code in the original post. Can you paste in the current categories function code?

After I asked you I worked it out and that code to display the product count as red :)

I do have more questions but regarding another subject mater :) But I create another post for that..

Thanks for help tom



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum