View Single Post
  #3 (permalink)  
Old 08-12-2009, 12:46 AM
bmcoll3278's Avatar
bmcoll3278 bmcoll3278 is offline
Senior Member
 
Join Date: Jun 2009
Posts: 303
bmcoll3278 is on a distinguished road
Default create a css menu from links

Ok now to make a css menu using the code above

You will need to add to the header section on your page some css code
Code:
<style type ="text/css">
body {  
 font: 75% Arial,sans-serif}
  text-align: center;
ul#minitabs{list-style: none;margin: 0;padding: 7px 0;
  border-bottom: 1px solid #CCC;font-weight: bold;
  text-align: center;white-space: nowrap}
ul#minitabs li{display: inline;margin: 0 2px}
ul#minitabs a{text-decoration: none;padding: 0 0 3px;
  border-bottom: 4px solid #FFF;color: #999}
ul#minitabs a#current{border-color: #F60;color: #06F}
ul#minitabs a:hover{border-color: #F60;color: #666}
  }
</style>
You can play with this code to change colors and text size

Now using the sql code we have been working with
Code:
<?php
$mysqluser = "your sql user"; ///change to your userid
$mysqlpass = "your sql password"; /// change to your password
$mysqldb = "your database name"; /// change to your database name
mysql_connect(localhost,$mysqluser,$mysqlpass);
@mysql_select_db($mysqldb) or die( "Unable to select database");

$result = mysql_query("SELECT * FROM dyn_menu where cat='your cat name'");
while($row = mysql_fetch_array($result))
{

$linky[0] = "$row[links]";
$linky[1] = "$row[link_url]";
$thelinks= "<a href='$linky[1]'> $linky[0]</a> <br>";
echo"$thelinks"; 
}
?>

change this line
Code:
$thelinks= "<a href='$linky[1]'> $linky[0]</a> <br>";
to this

Code:
$thelinks= "<li><a href='$linky[1]'>  $linky[0]</a></li>";
then you will add before the<?php
<ul id="minitabs">
and after the ?>
</div>
so here is the full code

Code:
<ul id="minitabs">
<?php
$mysqluser = "your sql user"; ///change to your userid
$mysqlpass = "your sql password"; /// change to your password
$mysqldb = "your database name"; /// change to your database name
mysql_connect(localhost,$mysqluser,$mysqlpass);
@mysql_select_db($mysqldb) or die( "Unable to select database");

$result = mysql_query("SELECT * FROM dyn_menu where cat='your cat name'");
while($row = mysql_fetch_array($result))
{

$linky[0] = "$row[links]";
$linky[1] = "$row[link_url]";
$thelinks= "<li><a href='$linky[1]'>  $linky[0]</a></li>";
echo"$thelinks"; 
}
?> 
</div>
If you want to see this menu in action click the link in my signature it is at the top of the page
__________________
I hope to build a site with something for every body
www.bmcoll.com
Reply With Quote