Friday, December 08, 2006

Simpl Join()!

Its amazing how much code can be reduced by using a framework, especially a framework that accomplishes all the most basic elements without interfering with usability. With Simpl we are trying to accomplish just that. So we recognized the problem of information being in two different tables and having two queries just was not cutting it. So we are proud to announce the Join() function in DbTemplate. This is now integrated into the examples also to get you up and running with it.

Here is a sample code snipit of joining the Registration, User and Payments tables to view information all in one list with one query:
// Create the Registration class
$myRegistration = new Registration;
$display[] = array('registration_id','user_id','date_registered','guests');

// Create the User Class
$tmpUser = new Users;
$myRegistration->Join($tmpUser, 'user_id', 'INNER');
$display[] = array('first_name','last_name');

// Create the Payments Class
$tmpPayment = new Payment;
$myRegistration->Join($tmpPayment, 'conference_id', 'INNER');
$display[] = array('conference_id', 'amount', 'status', 'method');

// Get a list of all the Registrations
$myRegistration->GetList($display,'date_registered','DESC');

Questions or Concerns? Head over to our Simpl Group.

Just added, Output individual fields

So PHP Simpl does a good job of outputting an XHTML form with very extend able features such as labels, required *'s, size and maxlength calculation, example and error output automatically. But have you ever just wanted to output the form in your own way? Well now you can, this can be accomplished with the FormField() function inside the DbTemplate class. It handles all that same great XHTML formatting, you just have to worry about where you want to flied to be displayed.

Function Prototype:
public function FormField($field, $hidden=false, $options='', $config='');

Example:
$myPost = new Post;
$hidden = false;
$options = array();
$config = array();

echo '<form>';
$myPost->FormField('title', $hidden, $options, $config);
echo '<input name="submit" value="Save" type="submit">';
echo '</form>';

Sunday, November 05, 2006

PHP Simpl Examples

PHP Simpl is a framework that is constantly evolving, and to help anyone who is interested in using the framework we are putting examples in the SVN repo. As of rev 125 we will continuously be adding to the examples folder which will outline the functionality of Simpl and get you up an running in no time. Currently there is just a show blog type application in there but we will be expanding it. Also if you have a good idea for an example or would like to submit your own just post in our group and we will be sure to help you.

Proxy Midterm Update

For our midterm in CSC5250 we were given the task to create an http proxy that handles GET/POST/HEAD requests. Well it all went well and my group got a 100%. The proxy actually preforms very well and handles most pages out there, and has a pretty sophisticated caching engine. Although there is a few drawbacks when the page uses some odd connection types to get its information and multi part POST's don't seem to be working but all in all we are very proud how it came out. I will probably be posting the code somewhere to get it out in the public and maybe a viable small scale proxy. We will have to wait till the end of the semester and get approval from my partner.

Friday, October 20, 2006

PHP Simpl, An Introduction

PHP Simpl is a a PHP framework for rapidly creating classes that mirror MySQL tables. The framework comes with the basic functions to list, display and edit records from the database. With this framework a simple manager and front of a site can be created within a few minutes. An example database, manager and front end are included with the framework.

Since this is a very new framework an introduction is in order.

First, Download the framework, we host it on Google Code and you can download it via Subversion.

Second, Put it on a server that supports PHP and MySQL. It does not have to be in a web viewable directory but currently it is recommended to be in /public_html/ root.

Setup the defines. There are a few defines that are nessisary to run PHP Simpl these must be declaired before the include of the class.
define('FS_SIMPL', '/public_html/simpl/');
define('DB_USER','user');
define('DB_HOST','localhost');
define('DB_PASS','pass');
define('DB_DEFAULT','my_blog');
define('DEBUG',false);
define('DEBUG_QUERY',false);
define('USE_CACHE',true);
define('CLEAR_CACHE',false);

The first one is manditory the rest are not, but it is a good idea to define them if you do not want to go into the main PHP Simpl config to change to debug mode or to clear the cache when you want to.

Next include the main class then load any helper classes you may need. This must be done before you include your own classes file.
include_once(FS_SIMPL . 'simpl.php');
$mySimpl->Load('Form');
$mySimpl->Load('Db');
$mySimpl->Load('DbTemplate');
$mySimpl->Load('Folder');
$mySimpl->Load('File');
$mySimpl->Load('Upload');
$mySimpl->Load('Image');

Now that you have PHPSIMPL up and running to write a simple class to mirror a mysql database table it is as simple as the example below.
class Post extends DbTemplate {
  function Post($data=''){
    $this->required = array('title','body');
    $this->table = 'blog_post';
    $labels =     array('is_published'=>'Published:','user_id'=>'Author:','category_id'=>'Category:');
    $examples = array('category_id'=>'ex. PHP, MySQL, Cars, XML, PHPSIMPL');
    $this->DbTemplate($data, $this->required, $labels, $examples, $this->table);
  }
}

And you are done, this Post class now has full interaction with the database table. You can use the helper GetValue() and SetValue() functions to get and set field values and all the helper functions to interact. You can also write custom functions just like you always would if you were not using PHP Simpl. A full list of functions and their parameters will be published soon, if you cannot wait just simply look through the PHP Simpl source, everything is commented in JavaDoc format for ease of use.

Sunday, October 15, 2006

Proxy Project Going Good.

So I finally got my new Mini and my new Desk all setup. Thats all i wanted to say. Oh yea and we are finally seriously working on a new look for the Wayne State University homepage, it desperately needs it (from a back end and management standpoint, the frontend pretty much just needs a realign), four years old and designed by a company that went out of business. Now that we have the tools in place we can get it setup right.

Also check out my Technorati Profile

Wednesday, October 04, 2006

Groups Beta... Impressed.

So Google has launched a Beta Groups site and I have been using it for a while now and all I can say is I am pretty impressed. It has kept my attention alot longer than I was planning to be reading my groups. For one the interface is alot better, this are orgainized into clusters and there is alot more options. I found I was totally side track configuring my group. Anyays the user manament is a million times better I have not had time to play with the Page Creator or the File Upload yet. One thing that i could not get to work, but it more than likely was my fault is the image upload for the user icon would not save for me. Oh well ill have to try it again tomorow.

Oh yea I am still waiting for a shipping date for my new Mac. :-/ Hopefully soon i can get down to some real development outside of work.

Sunday, October 01, 2006

Time for a new computer

So i broke down today and i bought a new computer. Well it is going to replace my current first generation Mac Mini G4 1.42 Ghz. Basically i found myself pretty much waiting 60% of the time instead of programming. Just having Eclipse, Photoshop, Apache, Firefox and iTunes open grinds this little machine to a halt. My solution yesterday was to just remote into my work machine and do all my work on that, it worked well but it is not a permanent solution. With my mom getting a new 20" iMac and the new Intel chips smoking the pants off the PowerPC chips i needed to upgrade. Also this will allow me to get rid of my Windows box for good, i will be running Parallels for any future Windows needs. The setup i ordered is not like super awesome impressive but it will do for now.
Mac Mini
1.83GHz Intel Core Duo
2GB 667 DDR2 SDRAM-2x1GB
120GB Serial ATA drive
SuperDrive 8x

A MacPro and a Mac Book Pro is on my wish list but not essential at this point. Once my current project which is a total back/front end re-development of their current architecture gets up and running ill need a more robust environment.

If anyone is interested i am selling my windows box, currently i am not selling the monitors (two 19" BenQ flat panels) but i will consider it if someone is interested, here is the setup:
AMD Athlon 3200+
512 Mb PC-3200
160 Gig, 2 SATA 150 drives in RAID-0
Nvidia Geforce FX 5700 Ultra
DVD-Rom
DVD-Burner DL 8x