Variable Visions

Make your own CMS

Published Sun. Sep. 23, 2012

These are the basic PHP principals for building a Content Management System (CMS)

-- INCLUDES FOR BREAKING THE SITE INTO MANAGEABLE PIECES (see index.php)

-- ECHOING out dynamic meta data based on query string variable (see top.php)

-- IF ELSE statments based on if certain query string variables are set (see middle.php)

-- DO WHILE LOOP for going through and displaying record sets based on your query string condition (see middle.php)

-- End all your div tags and body and html tags in bottom.php

 

 

index.php

<?php
include("includes/top.php");
include("includes/middle.php");
include("includes/bottom.php");
?>

 

top.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">
<head>

<title>www.variablevisions.com<?php if (!empty($tag)){?>/<?php }?>
<?php do { echo $row_newMETAdescriptionTAGS['tag']; ?>
<?php if (!empty($title)){?>/<?php }?>
<?php echo $tag_name3;?>
<?php if (!empty($title)){?>/<?php }?>
<?php echo $title;?>
</title>
<?php } while ($row_newMETAdescriptionTAGS = mysql_fetch_assoc($newMETAdescriptionTAGS));
mysql_free_result($newMETAdescriptionTAGS);?>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=max-device-width, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0, " />   
<meta name="robots" content="index, follow" />

<?php if (!empty($title)) {
do { ?> <meta name="keywords" content="<?php echo $row_newMETAkeywords['keywords']; ?>" />
<?php } while ($row_newMETAkeywords = mysql_fetch_assoc($newMETAkeywords));
mysql_free_result($newMETAkeywords);?>
<?php do { ?> <meta name="description" content="<?php echo $row_newMETAdescription['description']; ?>" />
<?php } while ($row_newMETAdescription = mysql_fetch_assoc($newMETAdescription));
mysql_free_result($newMETAdescription);
}
else { ?>
<meta name="keywords" content="3D, Acrobat, Analytics, Android, Apache, Audio, Books, Branding, Brochures, Business-Cards, Color-Correction, Command-Line, Direct-Mail, Email-Marketing, Fine-Art, Flash, Fonts, Gadgets, Graphic-Design, Hacks, Hardware, Illustrator, In-Design, JavaScript, Logos, Macintosh, Magazines, Marketing, Mobile-Devices, Motorsports, MySQL, Networking, Office-Space, PHP, Packaging, Photography, Photoshop, Podcasts, Preflighting, Printing, Publishing, Robotics, SPAM, Scanning, Servers, Signs, Tools, Typography, Video, Wallpaper, Web-Development, Web-hosting, XML, iPad, iPhone" />
<meta name="description" content="Graphic Design and PHP/MYSQL Content Management Solutions." />
<?php } ?>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" ></script>

<script type="text/javascript">
</script>

</head>
<body>
<div id="top">
<div id="topbar">
<img class="logo" id="logo" src="../images/vv-logo-round-sm.png" width="80" height="79" alt="Variable Visions" />
<a href="/">
<img class="logotext" id="logotext" src="../images/vv-logo-text.png" width="393" height="25" alt="Variable Visions" /></a>
</div>

<div id="mainmenu" class="mainmenu"><?php include("includes/mainmenu.php"); ?></div>
</div>

<div id="container">
<div id="main">
     

 


 

 

middle.php

<?php
/* HOME PAGE -- IF ALL THE QUERY STRING VARIABLES ARE NOT SET */
if (empty($tag) && empty($title) && empty($type) && empty($category) && empty($page)) { ?>
<?php do {
// Add content for the homepage like your jQuery slideshow markup
<?php } while (); ?>
<!-- YOU CAN ALSO PUT CSS INTO THE IF STATEMENT FOR CONDITIONAL STYLES -->
<style type="text/css">
</style>
<!-- CATEGORY LISTING FORM ONE OF YOUR QUERY STRING VARIABLES   -->
<?php } elseif (!empty($tag)) {?> 
<?php do { ?>
<!-- STYLE THE LIST OF ALL ARTICLES IN THE SAME CATEGORY  MAYBE JUST THE HEADLINE AND DATE WITH A THUMBNAIL IMAGE -->
<?php } while (); }
else {?><p>There are no articles</p><?php } ?>
<!-- SINGLE ARTICLE VIEW WHEN THE TITLE QUERY STRING IS SET  AKA NOT EMPTY  -->
<?php } elseif (!empty($title)) {?>      
<?php do { /*     STYLE THE VIEW TEMPLATE WITH A LARGER IMAGE AND ADD IN THE BODY TEXT FIELD */
<?php } while ();
?>

 


 

 

bottom.php

</div>
<!-- ENDING DIVS THAT DIDNT CLOSE IN TOP.PHP -->

<div id="footer"><?php include("includes/footer.php"); ?></div>
           
</body>
</html>