Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Roberto Martinez  >  Code Help  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: To use the class
Class: Code Help
Generate model, view and controller pattern code
Author: By
Last change:
Date: 2005-03-04 17:06
Size: 848 bytes
 

Contents

Class file image Download
<?php

include ('codehelp.class.php');

$codehelp = new codehelp('Person');

//set the name of the database and a prefix
$codehelp->setdb('person','p_');

//set the fields, type, if its primary key, the string to display and type of form control
// by now it only uses text
$codehelp->addDetails('id''int(6)'1'Id''no');
$codehelp->addDetails('name''char(8)'0'Name''text');
$codehelp->addDetails('addr''text'0'Address''text');
$codehelp->addDetails('country''text'0'Country''text');
$codehelp->addDetails('status''char(1)'0'Status''text');

// generate the code to be used
echo $codehelp->generatePageController();
echo 
$codehelp->generateModelClass();
echo 
$codehelp->generateViewClass();

// generate the schema of the database to use in MySQL
echo $codehelp->generateSQLSchema();