Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Kay-Uwe  >  tmpwiz  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example file
Class: tmpwiz
Template processing based on string replacement
Author: By
Last change: a little bug :D
Date: 2005-07-28 04:18
Size: 2,715 bytes
 

Contents

Class file image Download
<?
include("class.tmpwiz.php");

$header=new tmpwiz();  //init template object for header
$body=new tmpwiz();    //init template object for body 
$footer=new tmpwiz();  //init template object for footer

$header->load_tmp("head.htm"); //loading header file
$header->repleace_s("{title}","class.tmpwiz example"); //replacing a string
$header->print_tmp(); //direct output header to browser

$footer->load_tmp("foot.htm"); //loading footer file
$replace_array['{cpyrght}']="&copy; 2oo5 by Dodge";                #
$replace_array['{url}']="mailto:dodge@justmail.de";                #Stting up an array for repleace
$replace_array['{break_line}']="<br><hr width=50% align=left>"#
$footer->repleace_a($replace_array); //repleacing strings using an array

$body->load_tmp("body.htm"); //loading header file

/* Long string replace -begin- */
$body->repleace_s("{body_msg}","3.(ggf.) Ersetzen von Elementen<br> 
&nbsp;3.1Ersetzen mit Arrays<br> 
&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"variable\">\$array</span><span class=\"schar\">[</span><span class=\"string\">'{ersetze_das_mit}'</span><span class=\"schar\">]=</span><span class=\"string\">\"dem hier\"</span><span class=\"schar\">;</span><br> 
&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"variable\">\$array</span><span class=\"schar\">[</span><span class=\"string\">'{und_das_mit}'</span><span class=\"schar\">]=</span><span class=\"string\">\"etwas anderem\"</span><span class=\"schar\">;</span><br> 
&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"variable\">\$obj_name</span><span class=\"schar\">-></span>replace_a<span class=\"schar\">(</span><span class=\"variable\">\$array</span><span class=\"schar\">);</span><br> 
&nbsp;3.2Ersetzen einzelner Strings<br> 
&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"variable\">\$what</span><span class=\"schar\">=</span><span class=\"string\">\"{ersetze_das_mit}\"</span><span class=\"schar\">;</span><br> 
&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"variable\">\$with</span><span class=\"schar\">=</span><span class=\"string\">\"dem hier\"</span><span class=\"schar\">;</span><br> 
&nbsp;&nbsp;&nbsp;&nbsp;<span class=\"variable\">\$obj_name</span><span class=\"schar\">-></span>replace_a<span class=\"schar\">(</span><span class=\"variable\">\$what</span>,<span class=\"variable\">\$with</span><span class=\"schar\">);</span><br>"
);
/* Long string replace -end- */

$body->repleace_s("{foot}","<br><br>".$footer->print_tmp("vari")); //another string replacingbut using the output from the footer template as a part of the repleathe with parameter(output delivered over return)
$body->print_tmp(); //outputting body template (the footer informations are in this now because )

//script complete :D
//i hop my english sint soo bad ^_^
 
?>