MaiaTech Web Hosting and Online Application Development

Home

Web Hosting and Domain Registration
Domain
Registration

Domain Registration
Web Hosting
Web Hosting
Help
Help Web Hosting and Domain Registration Clients
Contact Us
Contact Us for Web Hosting and Domain Registration

Sign Up
Online


Client
Web Sites


Pay Bills
Online



Powered by
The Penguin

Get Firefox!

Get Free Online
Disk Space!

ShellPage Class

ShellPage has been replaced by VarPage, which is a little bit more flexible and almost as simple to use. You can choose either one.

ShellPage is a VERY simple PHP class for building websites based on Template files. All you have to do is design a template HTML file with a few comment tags in it, as the master design for your site. Then create each of your web site's pages as a PHP page that calls ShellPage and embeds your content into the template. Below is the class code itself. You can select and copy it to your own text editor.

ShellPage.class.php

<?php
class ShellPage {

   var $templatefile = "./template.html";
   var $title = "ShellPage Title";
   var $content = "<p>Page Content Here</p>";
  
   function ShellPage(){
   }
   
   function display_page() {
      $templatearray = file("$this->templatefile");
      $template = join("",$templatearray);
      $template = str_replace("<!--title-->","$this->title",$template);
      $templatesplit = explode("<!--content-->", $template);
      $templatetop = $templatesplit[0];
      $templatebot = $templatesplit[1];
      print $templatetop;
      print $this->content;
      print $templatebot;
   }
}
?>

Usage Example

To use ShellPage, simple create a web page, with banner, menu, etc., as you want it to appear on every page, leaving one large area where the main page content will be inserted. Then replace the title of the page with the comment "<!--title-->", and put the comment "<!--content-->" where you want the page content to be inserted. Then you are ready to make as many pages as you want. Below is an example:

<?php
include("ShellPage.class.php");

$page = new ShellPage;
$page->templatefile = "./template.html";
$page->title = "Welcome To My Page";

$content .= <<<EOD
<h2>Headline of My Page</h2>
<p>Some regular text on my page. Blah blah blah blah.
Blah blah blah blah. Blah blah blah blah. Blah blah blah blah. 
Blah blah blah blah. Blah blah blah blah. Blah blah blah blah. 
Blah blah blah blah. Blah blah blah blah. Blah blah blah blah. 
Blah blah blah blah. Blah blah blah blah. Blah blah blah blah. 
Blah blah blah blah. Blah blah blah blah. Blah blah blah blah. 
Blah blah blah blah. Blah blah blah blah. Blah blah blah blah.</p>
<p><a href="/">Back To Home Page</a></p>
EOD;

$page->content = $content;
$page->display_page();
?>


   • 410-788-1148 • © MaiaTech 2004