...

View Full Version : PHP/MSQL/CSS/HTML question Please



Byronwells
01-08-2010, 02:49 PM
Alright guys

I am not is this a php/mysql/css or html issue... Or all of them :)

I have just added this code {{categories}} to my website see here http://www.digitalresellersvault.com/marketplace.php in the categories section on the left hand side....

That code pulls all of the categories that I have added in the membership admin area from the msql database...

I would like those categories to be displayed exactly as how I did the manual ones, which is underneath in the light blue... Can someone help please?

tomws
01-08-2010, 03:38 PM
You need to style them with CSS.

Byronwells
01-08-2010, 05:22 PM
You need to style them with CSS.

How Do I do that?

I've been able to do it the manually way.. Where I add a list to it.. But if a list is automatically pick up from the database, how do I go about that?

tomws
01-08-2010, 06:20 PM
If you don't need a specific (different) style for the menu items from the db, then your css should already be set up for styling them. You do that by accessing the parent ul/ol and then each li. Like this:

ul#my-menu li
{
color: blue;
font-weight: bold;
}
It makes no difference if a menu item is built from a database or from hard-coded html. They're all styled through the CSS.

If you do need a specific style for those items, when you output the list with PHP, you just add your menu class to it so that the page's css styles everything the same.


echo '<ul class="my-menu">';
echo '<li>Some Static Item</li>';
echo '<li>Another Static Item</li>';
foreach ($dynamic_menu_items as $dynamic_menu_item)
{
echo '<li class="dyn-item">'.$dynamic_menu_item.'</li>';
}
Back in the page's css, do something like this:

li.dyn-item
{
color: red;
}

EDIT: I just looked at your html and you're using tables for those links. Don't. Strip that junk out and output the menu items just like the items already in the nav - links inside of li tags. Just doing that might fix your problem all by itself.

Byronwells
01-08-2010, 06:32 PM
If you don't need a specific (different) style for the menu items from the db, then your css should already be set up for styling them. You do that by accessing the parent ul/ol and then each li. Like this:

ul#my-menu li
{
color: blue;
font-weight: bold;
}
It makes no difference if a menu item is built from a database or from hard-coded html. They're all styled through the CSS.

If you do need a specific style for those items, when you output the list with PHP, you just add your menu class to it so that the page's css styles everything the same.


echo '<ul class="my-menu">';
echo '<li>Some Static Item</li>';
echo '<li>Another Static Item</li>';
foreach ($dynamic_menu_items as $dynamic_menu_item)
{
echo '<li class="dyn-item">'.$dynamic_menu_item.'</li>';
}
Back in the page's css, do something like this:

li.dyn-item
{
color: red;
}

EDIT: I just looked at your html and you're using tables for those links. Don't. Strip that junk out and output the menu items just like the items already in the nav - links inside of li tags. Just doing that might fix your problem all by itself.

Tom

Im not using tables.... I am using all div classes

see here
css code


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

* 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;


}





php code part



<li><a href="#">2009 Products</a></li>
<li><a href="#">December 09</a></li>
<li><a href="#">November 09</a></li>
<li><a href="#">October 09 </a></li>
<li><a href="#">September 09 </a></li>
<li><a href="#">August 09 </a></li>
<li><a href="#">July 09 </a></li>
<li><a href="#">June 09 </a></li>
<li><a href="#">May 09 </a></li>
<li><a href="#">April 09 </a></li>
<li><a href="#">March 09 </a></li>
<li><a href="#">February 09 </a></li>
<li><a href="#">January 09</a></li>
<li><a href="#">2008 Products </a></li>
<li><a href="#">December 08 </a></li>
<li><a href="#">November 08 </a></li>
<li><a href="#">October 08 </a></li>
<li><a href="#">September 08 </a></li>
<li><a href="#">August 08 </a></li>
<li><a href="#">July 08 </a></li>
<li><a href="#">June 08 </a></li>
<li><a href="#">May 08 </a></li>
<li><a href="#">April 08 </a></li>
<li><a href="#">March 08 </a></li>
<li><a href="#">February 08 </a></li>
<li><a href="#">January 08 </a></li>
<li><a href="#">Private Label Rights</a></li>
<li><a href="#">Master Resell Rights </a></li>
<li><a href="#">Personal Use </a></li>
<li><a href="#">Resell Rights </a></li>
<li><a href="#">Audio</a></li>
<li><a href="#">eBooks </a></li>
<li><a href="#">Graphics & Templates </a></li>
<li><a href="#">PLR Articles </a></li>
<li><a href="#">Rebrandable Software </a></li>
<li><a href="#">Software & Scripts</a></li>
<li><a href="#">Videos</a></li>

tomws
01-08-2010, 06:38 PM
Im not using tables....


Yes, you are:

<ul>
<li><br><table cellSpacing=0 cellPadding=5 align=center border=0><tr></tr><tr><td width=33% class=tbtext align=left valign=top> <a href=marketplace.php?cat=t&category=Dec_2008><font color=#0000FF>Dec 2008</font></a> (0)</td></tr><tr><td width=33% class=tbtext align=left valign=top> <a href=marketplace.php?cat=t&category=Videos><font color=#0000FF>Videos</font></a> (0)</td></tr><tr><td width=33% class=tbtext align=left valign=top> <a href=marketplace.php?cat=t&category=Private_Label_Rights><font color=#0000FF>Private Label Rights</font></a> (0)</td></tr><tr><td width=33% class=tbtext align=left valign=top> <a href=marketplace.php?cat=t&category=Master_Resale_Rights><font color=#0000FF>Master Resale Rights</font></a> (0)</td></tr><tr><td>&nbsp;</td></tr></table></li>

<li><a href="#">2009 Products</a></li>
<li><a href="#">December 09</a></li>
<li><a href="#">November 09</a></li>
<li><a href="#">October 09 </a></li>
<li><a href="#">September 09 </a></li>
<li><a href="#">August 09 </a></li>
<li><a href="#">July 09 </a></li>
<li><a href="#">June 09 </a></li>
<!-- and so on -->

Byronwells
01-08-2010, 06:47 PM
Tom

Before I upload the page to the server this what the whole of the left sidebar code look likes



<div id="l_sidebar">

<div class="leftboxheader">
<img border="0" src="http://www.digitalresellersvault.com/template/images/navgationalheader.jpg" width="175" height="33">
</div>


<div class="leftbox">
<ul>
<li><a href="#">Newest Products</a></li>
<li><a href="#">Dollar Deals</a></li>
<li><a href="#">Product Request</a></li>
<li><a href="#">DRV Blog</a></li>
<li><a href="#">RSS Updates</a></li>
<li><a href="#">DRV Affiliates</a></li>
<li><a href="#">Edit Profile</a></li>
<li><a href="#">Logout</a></li>
<li><a href="#">Sitemap </a></li>
</ul>
</div>




<div class="leftbottom">

</div>

<div class="leftboxheader">
<img border="0" src="http://www.digitalresellersvault.com/template/images/categoriesheader.jpg" width="175" height="33">
</div>
<div class="leftbox">

<ul>
<li>{{categories}}</li>

<li><a href="#">2009 Products</a></li>
<li><a href="#">December 09</a></li>
<li><a href="#">November 09</a></li>
<li><a href="#">October 09 </a></li>
<li><a href="#">September 09 </a></li>
<li><a href="#">August 09 </a></li>
<li><a href="#">July 09 </a></li>
<li><a href="#">June 09 </a></li>
<li><a href="#">May 09 </a></li>
<li><a href="#">April 09 </a></li>
<li><a href="#">March 09 </a></li>
<li><a href="#">February 09 </a></li>
<li><a href="#">January 09</a></li>
<li><a href="#">2008 Products </a></li>
<li><a href="#">December 08 </a></li>
<li><a href="#">November 08 </a></li>
<li><a href="#">October 08 </a></li>
<li><a href="#">September 08 </a></li>
<li><a href="#">August 08 </a></li>
<li><a href="#">July 08 </a></li>
<li><a href="#">June 08 </a></li>
<li><a href="#">May 08 </a></li>
<li><a href="#">April 08 </a></li>
<li><a href="#">March 08 </a></li>
<li><a href="#">February 08 </a></li>
<li><a href="#">January 08 </a></li>
<li><a href="#">Private Label Rights</a></li>
<li><a href="#">Master Resell Rights </a></li>
<li><a href="#">Personal Use </a></li>
<li><a href="#">Resell Rights </a></li>
<li><a href="#">Audio</a></li>
<li><a href="#">eBooks </a></li>
<li><a href="#">Graphics & Templates </a></li>
<li><a href="#">PLR Articles </a></li>
<li><a href="#">Rebrandable Software </a></li>
<li><a href="#">Software & Scripts</a></li>
<li><a href="#">Videos</a></li>
</ul>
</div>


<div class="leftbottom">

</div>
</div>




</body>
</html>


From what you are saying a table is created.. From what I can gather it has got to do with the code {{categories}} which is the part that read from the msql database, or does that keyword read from another file?

tomws
01-08-2010, 06:54 PM
From what you are saying a table is created.. From what I can gather it has got to do with the code {{categories}} which is the part that read from the msql database, or does that keyword read from another file?

That would appear to be the culprit. I have no idea why it's producing a table, but I can say that {{categories}} isn't a magic PHP keyword that dumps database info into an html table. Where did you get the idea to use it? Template system? CMS? Whatever system you're using should provide documentation for describing how to theme the results.

Byronwells
01-08-2010, 06:57 PM
That would appear to be the culprit. I have no idea why it's producing a table, but I can say that {{categories}} isn't a magic PHP keyword that dumps database info into an html table. Where did you get the idea to use it? Template system? CMS? Whatever system you're using should provide documentation for describing how to theme the results.

Tom

What is your email addy please?? I got it from the membership script that I am using....

tomws
01-08-2010, 07:03 PM
If you need to send info that shouldn't be viewed publicly, use the private message system here. The PM user links are near the upper right hand corners of each post.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum