It shows that you are unregistered. Please register with us by clicking Here
![]() |
|
![]() |
![]() | Register - FAQ - Today's Posts - New Posts - Support - Search | ![]() |
| View Poll Results: Cast your vote for your favorite: | |||
| 1. Brandi |
|
1 | 11.11% |
| 2. the other blonde |
|
3 | 33.33% |
| 3. Brunette in the cowboy hat |
|
1 | 11.11% |
| 4. Meghan |
|
4 | 44.44% |
| 5. Actress/Singer |
|
0 | 0% |
| 6. Girl in Grey Shirt |
|
0 | 0% |
| Voters: 9. You may not vote on this poll | |||
![]() |
![]() |
|
LinkBack | Thread Tools | Display Modes | ![]() |
|
|
#1 (permalink) |
|
Senior Member
Join Date: Jul 2006
Location: Swansea, Wales, UK
Age: 20
Posts: 239
|
Code:
<?php
class IdevsPage
{
var $Template;
var $Replacement;
function IdevsPage($template="")
{
if(file_exists($template)) $this->Template = file($template);
}
function BuildReplacement($start,$finish)
{
$count = count($this->Replacement);
$this->Replacement[$count][0] = $start;
$this->Replacement[$count][1] = $finish;
}
function PopulatePage()
{
for($x=0;$x<=count($this->Template)-1;$x++)
{
$NewArray[$x] = $this->Template[$x];
for($y=0;$y<=count($this->Replacement)-1;$y++)
{
$NewArray[$x] = str_replace($this->Replacement[$y][0],$this->Replacement[$y][1],$NewArray[$x]);
}
}
$this->Template = $NewArray;
return TRUE;
}
function LoadPage()
{
for($x=0;$x<=count($this->Template)-1;$x++)
{
echo $this->Template[$x];
}
return TRUE;
}
}
class IdevsModule
{
var $Template;
var $Replacement;
function IdevsModule($template="")
{
if(file_exists($template)) $this->Template = file($template);
}
function BuildReplacement($start,$finish)
{
$count = count($this->Replacement);
$this->Replacement[$count][0] = $start;
$this->Replacement[$count][1] = $finish;
}
function MakeModule()
{
$NewArray = array();
for($x=0;$x<=count($this->Template)-1;$x++)
{
$NewArray[$x] = $this->Template[$x];
for($y=0;$y<=count($this->Replacement)-1;$y++)
{
$NewArray[$x] = str_replace($this->Replacement[$y][0],$this->Replacement[$y][1],$NewArray[$x]);
}
}
$this->Template = $NewArray;
return TRUE;
}
function GetModule()
{
$ReturnValue = "";
for($x=0;$x<=count($this->Template)-1;$x++)
{
$ReturnValue .= $this->Template[$x];
}
return $ReturnValue;
}
}
?>
Now for some sample code: index.itf Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="english"> <head> <title><!Title!></title> <meta name="author" content="Jamie Lewis" /> <meta name="description" content="The development blog and portfolio of Jamie Lewis." /> <meta name="keywords" content="idevs, web, dev, development, internet, portfolio, jamie, lewis" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="styles/main.css"/> <link rel="shortcut icon" href="http://localhost/idevs/images/favicon.ico" /> </head> <body> <div id="content"> <div id="header"> <h1><span class="noDisplay">Idevs - That Exactly What I Do</span></h1> </div> <div id="menu"> <ul> <li><a href="index.php" class="<!BlogLink!>">Blog</a></li> <li><a href="about.php" class="<!AboutLink!>">About</a></li> <li><a href="portfolio.php" class="<!PortfolioLink!>">Portfolio</a></li> </ul> </div> <div id="body"> <!Content!> </div> <div id="footer"> <p>All content on this site is © Copyright Jamie Lewis, 2006. All Right Reserved</p> </div> </div> </body> </html> Code:
<?php
include("page.class.php");
$Title = "Blog";
$Content = "";
$Page = new IdevsPage("index.itf");
$Page->BuildReplacement("<!Title!>",$Title);
$Page->BuildReplacement("<!Content!>",$Content);
$Page->BuildReplacement("<!Style!>","blog.css");
//Links
$Page->BuildReplacement("<!BlogLink!>","Current");
$Page->BuildReplacement("<!AboutLink!>","Normal");
$Page->BuildReplacement("<!PortfolioLink!>","Normal");
$Page->PopulatePage();
$Page->LoadPage();
?>
If anyone needs a hand then just ask ;D Jamie
__________________
|
|
|
|
|
|
|
|
#3 (permalink) |
|
Senior Member
Join Date: Jul 2006
Location: Swansea, Wales, UK
Age: 20
Posts: 239
|
Yeah, I normally only comment my code if I consider it a)important and b) finished. when im working with c++ i usually have comments like
Code:
//DONT edit this. It took me too long to write. Jamie
__________________
|
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [PHP5] Code Snippet: Template System Suited to small scale scripts | Gamelab | PHP | 2 | 10-12-2006 02:08 AM |
| Little Johnny in Math Class | krunkfunk | Jokes / Humor | 0 | 10-03-2006 02:55 AM |
| [PHP5] A SQL class | Seph | PHP | 1 | 07-24-2006 07:21 PM |
| Synchronizing file to class | Tom Tom | .NET | 0 | 07-06-2006 02:06 PM |
| Class Room Art | NuFlo | Graphics & Multimedia | 3 | 09-19-2005 12:58 AM |