Okay, I'm trying to use my counter I made with the 3DBuzz videos on my website, as well as make my navigation hyperlinks URL's be pulled from a file called nav.php and just be variables so that I can edit that one file and edit the links of all the pages.
I'll post the code to my index.php page... (It was index.html so don't wonder why it has no php, I need to know how to do that from you guys.. 🙂)
<title>Da Cliq</title>
<HEAD>
<STYLE TYPE="text/css">
BODY
{
scrollbar-base-color: 222222;
scrollbar-arrow-color: 222222;
scrollbar-DarkShadow-Color: 222222;
scrollbar-Highlight-Color: 222222;
}
a:link { color: blue; text-decoration: none }
a:active { color: blue; text-decoration: none }
a:visited { color: blue; text-decoration: none }
a:hover { color: blue; text-decoration: underline}
a.nav:link { color: white; text-decoration: none }
a.nav:active { color: white; text-decoration: none }
a.nav:visited { color: white; text-decoration: none }
a.nav:hover { color: white; text-decoration: underline}
</STYLE>
</HEAD>
<body bgcolor="#222222">
<table border="1" cellpadding="0" cellspacing="0" width="600" height="100%" align="center" class="main" bgcolor="000000" bordercolor="FFFFFF">
<tr>
<td height="30">
<table border="0" cellpadding="0" cellspacing="0" class="null" width="100%" bgcolor="000000">
<tr>
<td><font face="verdana, arial" color="#ffffff" size="1"><center>Welcome to the home of Da Cliq, an elite SOCOM clan!</center></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td><img src="images/logo.jpg" width="600" height="120" border="0"></td>
</tr>
<tr>
<td height="20" style="border:0px;">
<table border="1" cellpadding="3" cellspacing="0" class="menu" width="100%" bgcolor="000000">
<tr>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="home.php" class=nav>Home</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="schedule.html" class="nav">Schedule</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="roster.html" class="nav">Roster</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="record.html" class="nav">Record</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="rules.html" class="nav">Clan Rules</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="forum" class="nav">Forum</center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="challenge.html" class="nav">Challenge Us</center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="join.html" class="nav">Join [DC]</center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="links.html" class="nav">Links</center></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding:4px 10px;" height="100%" valign="top">
<br/>
<table border="0" cellpadding="0" cellspacing="0" class="null" width="100%" bgcolor="000000">
<tr>
<td><img src="images/news.jpg" border="0"/></td>
</tr>
</table>
<br/>
<font face="verdana, arial" color="#ffffff" size="1"><b>Posted by: DS XiV on 9/30/03.</b></font><br>
<font face="verdana, arial" color="#ffffff" size="1">Our website is up! I hope everyone enjoy's it!</font>
</td>
</tr>
<tr>
</table>
</body>
</html>
I know its not the nicest code but I'm new..
Now, I wanted to add this counter script:
<?php
require($_SERVER["DOCUMENT_ROOT"]."/db_config.php");
$connection = @mysql_connect($db_host, $db_user, $db_password) or die("Error connecting to DB!");
mysql_select_db($db_name, $connection);
$query = "SELECT * FROM counter";
$result = mysql_query($query, $connection) or die(mysql_error());
$views = mysql_result($result, 0, "num_views");
$views++;
$query = "UPDATE counter SET num_views = $views";
mysql_query($query, $connection) or die(mysql_error());
echo "This page has been viewed ".$views." times";
?>
I want to add this to the area of my original coding, the part I want to put it in is:
<table border="0" cellpadding="0" cellspacing="0" class="null" width="100%" bgcolor="000000">
<tr>
<td><font face="verdana, arial" color="#ffffff" size="1">Welcome to the home of Da Cliq, an elite SOCOM clan!</font></td>
</tr>
</table>
That code puts that text on the left of the table, now I want it to say: Hits: 578 on the right of that table, so put the align code to put it on the right.
Now, onto making the links variables.. I want to open PHP, require the file that has the variables in it, use them like this:
<table border="1" cellpadding="3" cellspacing="0" class="menu" width="100%" bgcolor="000000">
<tr>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="$home" class=nav>Home</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="$schedule" class="nav">Schedule</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="$roster" class="nav">Roster</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="record.html" class="nav">Record</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="rules.html" class="nav">Clan Rules</a></center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="forum" class="nav">Forum</center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="challenge.html" class="nav">Challenge Us</center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="join.html" class="nav">Join [DC]</center></font></td>
<td><font face="verdana, arial" color="#ffffff" size="1"><center><a href="links.html" class="nav">Links</center></font></td>
</tr>
</table>
If you look at the first three links you can see how I want to do it buut I need to know where to put echo's and all that, so can someone help? I know it seems like a whle lot of code but the actual coding needed to be done for this is not hard. And you all don't need to worry about making the files that we are requiring.
Thanks A LOT to anyone who helps!!