Code2Design.com

User login

The Layout

Programming

Graphic Design

Resources

Navigation

C2D Projects

Unsystematic Affiliates

Pixel Designz AOM Designs Photoshop Lab Miligraf 

Change Language

Who's online

There are currently 0 users and 6 guests online.

You Can CMS Without One

For several years now, I've been creating mini CMS's without realizing it - actually before there was such a term. It's made all the difference in the world in maintaining websites, especially with over 50 sites like we watch over. How do I do it? Thought you'd never ask. :)

This requires either PHP or SSI (Server Side Includes). I'll be talking about the PHP method here, but can show the other if there's a demand.

First step is to create your first page normally and get it just the way you want it. Then examine your source to see what will be repeated on the rest of the pages on the top and bottom.

Whatever part of the code will be repeated at the top of each page, remove from your page and paste into a document of it's own called header.php. The part that will be at the bottom of each page, remove and place in a document called footer.php. In your original document, put the following in place of the contents of the new header.php:

<?php include("header.php"); ?>

In place of the contents of the new footer.php, put the following:

<?php include("footer.php"); ?>

Here's what you should end up with:
Main Document

<?php include("header.php"); ?>

. . .

PAGE CONTENTS

. . .

<?php include("footer.php"); ?>

header.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>My Site</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div id="container">

footer.php

<div id="footer">
<p>© 2007 My Design Company</p>
</div>
</div>
</body>
</html>

What this does is allow you to concentrate on the contents of the individual page without weeding through the stuff that's got to be at the top and bottom of each page, which can be extensive depending on the layout. Also, if you need to tweak something in the top or bottom of the pages, you only have to change it in one place and it's instantly changed across every page that includes it.

I hear you saying to yourself, "Well that's cool. I can see where that might save me some time. Is that all there is, though?" Not at all. In the next installment, I'll share some techniques to make this idea "stand up and dance." Stay tuned.


Submitted by maspick on February 9, 2007 - 8:08pm. |
maspick's blog | printer friendly version

save as (webpage).php

Hi all,
I just figured this out for myself, it's kind of well... how to put it.. well Duhh!??

well all I really need to say is don't forget to save :

<?php include("header.php"); ?>

. . .

PAGE CONTENTS

. . .

<?php include("footer.php"); ?>

as (yourwebpage).php not (yourwebpage).html :)


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <br> <br /> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use BBCode tags in the text, URLs will be automatically converted to links
More information about formatting options



Like what you see?

Why not add more? C2D is looking for other Christian Web Masters who would like to help write articles for this site. If you have expericance in FLASH, CSS/HTML, PHP/MySQL, PhotoShop/GIMP, Blender, Javascript, or just General Design - our users would love to hear what you have to say. Contact Us

delicious   digg   reddit   magnoliacom   newsvine   furl   google   yahoo   technorati