PHP Classes

File: example.php

Recommend this page to a friend!
  Classes of mohamad Reza kavoosi   HTML preRender   example.php   Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example use of class
Class: HTML preRender
Preprocess templates and assign form input values
Author: By
Last change:
Date: 12 years ago
Size: 1,769 bytes
 

Contents

Class file image Download
<?php
require_once 'HTMLPreRender.php';
$MasterPage = new Html("./MaterPage.tpl");
$index = new Html('./index.tpl');


//SIMPLE 1: set Title for Page
$MasterPage->titlePage("THIS IS MASTER PAGE SIMPLE");
//SIMPLE 2: append element Into Head
$MasterPage->AppendHead("<meta name='title' content='PHP:xxx'/>");


//SIMPLE 3: change content tag by id,name,title or className of tag
$index->innerHTML("myname","mohamad reza Kavoosi");// my name is id
$index->innerHTML("myclass","newValue",false);// multi div with class='myclass'
$MasterPage->innerHTML("datetime",date("Y/m/d H:i:s")); //datetime is title for span
$index->TextBox("email","spnuac@gmail.com");//fill textbox name='email'
$index->Radio("sex","woman");//select itam of radio sex with value='woman'
$index->DropDownList("country","IRAN");//select option with value='IRAN' in dropdownlist `country`
$index->CheckBox("accept");//checked checkbox name='accept'
$index->TextArea("address","iran , shiraz ....");// fill textarea name='address'
$index->HiddenField("hidden1",2);//fill hiddenfield name='hidden1'
$MasterPage->Attribute("footer","style","background-color:#ccc");//set attribute style='background-color:#ccc' for `footer` tag
$index->removeTag("loginpanel");// remove tag with id='loginpanel'

//SIMPLE 4: add div(id='div2') into div(id='myname') and so set new content for `div2`
$index->innerHTML("myname","<div id='div2'></div>");
$index->innerHTML("div2","new content");

//SIMPLE 5: this function get $_POST data , found controls and fill with thats posted value
$index->PostedDataToControls($_POST);

// SIMPLE 6: index template into master page template(`contentPage is div in masterPage`)
$MasterPage->innerHTML("contentPage",$index);
echo (
$MasterPage);