Login   Register  
PHP Classes
elePHPant
Icontem

File: start.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Valics Lehel  >  PHP or Java Class Code Generator  >  start.php  >  Download  
File: start.php
Role: Application script
Content type: text/plain
Description: app script
Class: PHP or Java Class Code Generator
Generate PHP or Java database access classes
Author: By
Last change:
Date: 2008-02-07 12:15
Size: 2,500 bytes
 

Contents

Class file image Download
<?php
include_once("./config.inc.php");
include_once(
INCLUDE_PATH."cls_fast_template.php");
include_once(
INCLUDE_PATH."cls_string.php");
$stringutil = new String("");
$all_url_vars=array();
$all_url_vars=$stringutil->parse_all();
$all_url_vars['table']=$stringutil->changeBRtoEnter($all_url_vars['table']);
$all_url_vars['table']=strtolower($all_url_vars['table']);
$tok=explode(",",$all_url_vars['table']);
//print_r($tok);
//print $stringutil->changeBRtoEnter($all_url_vars['table']); exit;
$toknr=sizeof($tok);
//print $toknr;
$fpos=strpos($tok[0],"(");
$firsttok=substr($tok[0],0,$fpos);
$firsttok=strtolower($firsttok);
$firsttok=str_replace(" ","",$firsttok);
$firsttok=str_replace("createtable","",$firsttok);

if(
$firsttok[0]=="`")
{
$firsttok=substr($firsttok,1,strlen($firsttok));
}
if(
$firsttok[strlen($firsttok)-1]=="`")
{
$firsttok=substr($firsttok,0,strlen($firsttok)-1);
}
$ft = new FastTemplate(TEMPLATE_PATH);
$ft->define(array("main"=>"template_body.html""content"=>"template_generate.html"));
$ft->assign("TABLE",$firsttok);
//FIELDS
$fields="";
for(
$i=0;$i<$toknr;$i++)
{
if(
$i==0)
{
$buffer=substr($tok[0],$fpos+1);
$fbuffer=explode(" ",ltrim($buffer));
$fbnr=sizeof($fbuffer);
//print_r($fbuffer);
$z=0;
while(empty(
$fbuffer[$z]) or $fbuffer[$z]=="`")
{
$z++;
}
$field=$fbuffer[$z];
if(
$field[0]=="`")
$field=substr($field,1,strlen($field));
if(
$field[strlen($field)-1]=="`")
$field=substr($field,0,strlen($field)-1);
if(
$field!="primary" and $field!="key"and $field!="index" and $field!="unique" and $field!="fulltext" and $field!="foreign" and $field!="check")
{
    
$fields.=$field;
    
$fields.=";";
}
}
else
{
$fbuffer=explode(" ",ltrim($tok[$i]));
$fbnr=sizeof($fbuffer);
$z=0;
while(empty(
$fbuffer[$z]) or $fbuffer[$z]=="`")
{
$z++;
}
$field=$fbuffer[$z];
if(
$field[0]=="`")
$field=substr($field,1,strlen($field));
if(
$field[strlen($field)-1]=="`")
$field=substr($field,0,strlen($field)-1);
if(
$field!="primary" and $field!="key" and $field!="index" and $field!="unique" and $field!="fulltext" and $field!="foreign" and $field!="check")
{
$fields.=$field;
$fields.=";";
}
}
}
$ft->assign("DBFIELDS",$fields);
$tokexample=explode(";",$fields);
    
$tokenr=sizeof($tokexample);
    
$example="";
    for(
$i=0;$i<$tokenr-1;$i++)
    {
        
$example.=ucwords($tokexample[$i]);
        
$example.=";";
    }
$ft->assign("EXAMPLE",$example);

$ft->parse("BODY", array("content","main"));
print 
$ft->fetch("BODY");
?>