General Statistics
390 Tutorials
202 Total Votes
25 User(s) Online
770274 Views Total
3000 Registered Members
24534 Posts Total
Rooneyfeld is our newest member
About this Tutorial: Advanced Tutorial CMS Script v1
Advanced Tutorial CMS Script v1
Rated 5 / 4 Votes

Advanced Tutorial CMS Script v1

The ultimate tutorial content management system. With built in self installer and administration panel, its your all in one package!


Date Added: November 21, 2005 [ 25691 Views - 4 Votes ] [ Rate ]

Author: Chaos King [ PHP Coding ] [ 27 Comment(s) ]

Advanced Tutorial CMS Script v1
Note: Check out Tutorial CMS (www.tutcms.com) for updates on the new script!

4) We are half way there! Now, lets create the file tutorials.php. Please remember that there should be a db.php in the same directory also. Add this code in there:

CODE

<?php

//Getting the file db.php which includes our database settings. 
define( 'DB_PATH'  , "./" );
require DB_PATH."db.php";


//Setting up a variable to request the category which is in the URL
$request_cat = $_REQUEST['category'];


//Displaying an actual tutorial
if (isset($id)) {

// Updating the views, and grabbing a tutorial based on what id it has.
$update = mysql_query("UPDATE $mysql_table SET views = views + 1 
WHERE id='$id'");
$result = mysql_query("SELECT * FROM $mysql_table
WHERE id='$id'");
while($row = mysql_fetch_array($result)){
 
  // Template for the tutorial
  echo "
  <table width='400' border='0' cellspacing='0' cellpadding='0'>
<tr>
  <td width='400'>
<table width='400' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td><table width='400' border='0' cellspacing='0' cellpadding='0'>
    <tr>
      <td width='275'><div align='left'><strong>
<a href='tutorials.php?category=".$row['category']."&id=".$row['id']."
'>".$row['title']."</a>
</strong></div></td>
      <td width='125'><div align='right'>
[ Views: ".$row['views']." ]</div></td>
    </tr>
      </table></td>
    </tr>
<tr>
<td><div align='left'>Description: ".$row['description']."</div></td>
    </tr>
<tr>
<td><div align='left'>".$row['content']."</div></td>
    </tr>
<tr>
<td><div align='left'>
    <table width='400' border='0' cellspacing='0' cellpadding='0'>
      <tr>
      <td width='150'><div align='left'>Added: ".$row['date']."</div>
</td>
  <td><div align='right'>Author:
<a href='mailto:".$row['email']."'
>".$row['author']."</a> </div></td>
      </tr>
    </table>
      </div></td>
    </tr>
<tr>
  <td><div align='left'>Category:
<a href='tutorials.php?category=".$row['category']."
>".$row['category']."</a> </div></td>
    </tr>
  </table></td>
    </tr>
  </table> 
  "; // End of template of tutorial
} // End of grabbing data
  exit(); // Stopping anything below from interfearing with this sectiom
} // End of Displaying an actual tutorial


//Displaying tutorials in a cateogry.
if ($category == $request_cat) {

//Grabbing information from the database.
$result = mysql_query("SELECT * from $mysql_table
where category = '$category' ORDER BY ID DESC");
while($row = mysql_fetch_array($result)) {

  //Template for the tutorials in a category.
  echo "
  <table width='400'  border='0' cellspacing='0' cellpadding='0'>
<tr>
  <td width='100' align='center' valign='middle'><div align='center'>
<a href='tutorials.php?category=".$row['category']."&id=".$row['id']."'>
<img src='".$row['avatar']."' alt='".$row['title']."'  title='".$row['title']."'
width='90' height='60' border='0'></a>
</div></td>
  <td width='300'>
<table width='100%'  border='0' cellspacing='0' cellpadding='0'>
    <tr>
<td>
<div align='center'><strong>".$row['title']."</strong></div></td>
    </tr>
    <tr>
<td>
<div align='left'>Description: ".$row['description']."</div></td>
    </tr>
    <tr>
<td>
<table width='100%'  border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td><div align='left'>Added: ".$row['date']."</div></td>
    <td><div align='left'>Category:
<a href='tutorials.php?category=".$row['category']."
>".$row['category']."</a></div></td>
    </tr>
    </table></td>
    </tr>
    <tr>
<td><table width='100%'  border='0' cellspacing='0' cellpadding='0'>
  <tr>
    <td width='175'><div align='left'>Author:
<a href='mailto:".$row['email']."'>".$row['author']."</a></div></td>
    <td width='100'><div align='left'>Views: ".$row['views']."</div></td>
      </tr>
    </table></td>
    </tr>
  </table></td>
    </tr>
  </table><br>
  "; // End of Template for the tutorials in a category.
} // End of grabbing information from database.
} // End of Displaying tutorials in a cateogry.


// Main Tutorial page.  This is where all your categories will be listed. 
if (!$category) {

//This makes a list of all the cateogries that are in the database!  No need to make the links yourself!
$result = mysql_query("SELECT DISTINCT category from $mysql_table ");
while($row = mysql_fetch_array($result)) {
 
  // Showing all the categories
  echo "
  <a href='tutorials.php?category=".$row['category']."'
>".$row['category']."</a><br>
  "; // End of showing all the categories
} // End of grabbing unique categories in database
}// End of main tutorial page

?>



Total Pages (5)
<<Prev 1 2 3 [4] 5 Next>>

Welcome User
Welcome Guest
( Login | Register )

Latest Tutorial Index - RSS Feed
Latest Resources - RSS Feed
Latest Tutorials - RSS Feed
Vote for Us
  • VixxIMG.com - Free Image Hosting, Free Myspace Image Hosting, Free Image Uploads
  • PageRank Plus - Google PageRank checking, with a twist.
Random Affilaites