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 Johan de Jong  >  Core class  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Core class
Load framework objects
Author: By
Last change:
Date: 2010-05-27 02:46
Size: 905 bytes
 

Contents

Class file image Download
<?php

// include the class
require_once('core.class.php');

// create object
$core = new Core();


// EXAMPLE CODES

// add database object
$core->Database;

// use database object
$core->Database->query("SELECT ...");

// add variable and print later
$core->test 'test';
print 
$core->test;

// example use in other classes

class Foo extends Core {
   public function 
setBar($name$value) {
      
$this->Bar->{$name} = $value;
   }
   public function 
getBar($name) {
      return 
$this->Bar->{$name};
   }
}

class 
Bar extends Core {
   public function 
printAll() {
      return 
get_class_vars__CLASS__ );
   }
}

$core->Foo->setBar('foo''bar');
$core->Foo->setBar('lorem''ipsum');

print 
$core->Foo->getBar('foo');
// result: 'bar'

print_r$core->Bar->printAll() );
// result:
// Array
// (
//    [foo] = bar
//    [lorem] = ipsum
// )

?>