PEAR Articles
  Home arrow PEAR Articles arrow Building the View Details Page in a PEAR CMS
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PEAR ARTICLES

Building the View Details Page in a PEAR CMS
By: David Web
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-11-05

    Table of Contents:
  • Building the View Details Page in a PEAR CMS
  • Code Explained
  • Table with Navigation Panel
  • Displaying the Article

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Building the View Details Page in a PEAR CMS


    (Page 1 of 4 )

    In the last article we looked at how the main script for the CMS system works. In this article we will explore the page that enables us to view an article in full detail. Keep reading to find out how we will make this page work.

    This is the purpose of this script. The setup of this script is somewhat similar to the main script, so you won't see too much new code here. Nevertheless, it is worth going through the code that makes up the script.

    The view.php script



    Below is the entire code for the view script:

    <?php

    session_start();

    if(!isset($_SESSION['author_name'])){

    //redirect to login page

    header("location:login.php");

    }


    ?>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main.dwt.php" codeOutsideHTMLIsLocked="false" -->

    <head>

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

    <!-- InstanceBeginEditable name="doctitle" -->

    <title>Untitled Document</title>

    <!-- InstanceEndEditable -->

    <!-- InstanceBeginEditable name="head" -->

    <!-- InstanceEndEditable -->

    <link href="Templates/pear.css" rel="stylesheet" type="text/css" />

    </head>


    <body>

    <table width="100%" border="0" class="bord">

    <tr class="header1">

    <td colspan="2"><div align="center">Content Management System </div></td>

    </tr>

    <tr>

    <td width="5%" valign="top"><!-- InstanceBeginEditable name="EditRegion4" -->

    <table width="100%" border="0" cellspacing="0" class="navbord">

    <tr>

    <td colspan="2" bgcolor="#FFFFFF">&nbsp;</td>

    </tr>

    <tr>

    <td colspan="2" bgcolor="#0066FF" class="section"><strong>Section</strong></td>

    </tr>

    <tr class="navbord">

    <td class="nav"><a href="logout.php">Logout</a> </td>

    <td><img src="images/user.gif" width="16" height="16" alt="" /></td>

    </tr>

    <tr class="navbord">

    <td colspan="2" class="nav"><a href="main.php">Home</a></td>

    </tr>

    <tr class="navbord">

    <td colspan="2" class="nav"><a href="authors.php">Authors</a></td>

    </tr>

    <?php if($_SESSION['level']=="admin"){?>

    <tr class="navbord">

    <td colspan="2" class="nav"><a href="admin/index.php">Admin</a></td>

    </tr>

    <?php }?>

    </table>

    <!-- InstanceEndEditable --></td>

    <td width="95%" valign="top"><!-- InstanceBeginEditable name="EditRegion3" -->

    <table width="100%" border="1">

    <tr>

    <td colspan="2" class="title">&nbsp;</td>

    </tr>

    <?php

    include 'db.php';

    include 'connx.php';


    if(isset($_GET['aid'])){

    if(is_numeric($_GET['aid'])){

    $aid=mysql_real_escape_string($_GET['aid']);

    $sql = "SELECT * FROM stories WHERE aid='".$aid."'";

    }else{

    echo "Error invalid format";

    }

    }


    if(isset($_GET['sid'])){

    if(is_numeric($_GET['sid'])){

    $sid=mysql_real_escape_string($_GET['sid']);

    $sql = "SELECT * FROM stories WHERE sid='".$sid."'";

    }else{

    echo "Invalid Format";

    }

    }


    $res = $db->query($sql);

    if($res){

    while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {

    ?>

    <tr class="title">

    <td colspan="2" class="title"><?php print $row->title ?></a></td>

    </tr>

    <tr>

    <td width="18%">&nbsp;</td>

    <td width="82%" class="auth"> published on: <?php print $row->s_date ?></td>

    </tr>

    <tr>

    <td colspan="2" class="maintxt"><p><?php print $row->story ?></p></td>

    </tr>

    <?php }

    }else{

    ?>

     

    <tr>

    <td colspan="2" class="maintxt"><p>No article found</p></td>

    </tr>

    <?php } ?>

    </table>

    <!-- InstanceEndEditable --></td>

    </tr>

     

    <tr class="copy">

    <td colspan="2">&copy;2008</td>

    </tr>

    </table>

    </body>

    <!-- InstanceEnd --></html>

    More PEAR Articles Articles
    More By David Web


     

    PEAR ARTICLES ARTICLES

    - Deleting Authors from a PEAR Content Managem...
    - PEAR CMS: Index and Delete Scripts
    - Listing Articles for a PEAR Content Manageme...
    - Building an Authors Page for a PEAR CMS
    - Building the View Details Page in a PEAR CMS
    - Creating the Main Pages of a PEAR CMS
    - Completing the Login Script for a PEAR CMS
    - User Authentication for a PEAR CMS
    - A PEAR CMS: Examining the Code
    - Building a Content Management System with PE...
    - Installing a PEAR Package
    - My PEAR: The Beginning
    - Using XML_RPC2 with PEAR
    - Using Web Service APIs (Amazon and Yahoo!) w...
    - Database Abstraction with MDB2 from PEAR





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT