Showing posts with label phpsimpl. Show all posts
Showing posts with label phpsimpl. Show all posts

Monday, July 16, 2007

PHPSimpl 0.8.2 Feature Update

Just keep adding features
So after some time working with the current release we noticed some areas where improvement was needed. So what did we do? We improved in all the wonderful ways below:
  • Added a debug.log file to debug a live site in real time, best used with "tail -f"
  • Added the ErrorMessages() function to summarize a forms errors, similar to Rails.
  • Added the SetConditions() function so querying for >, <, <=, LIKE and OR's are all possible now.
  • Added a Get and Set Folder name functions in the Folder Class.
  • DisplayList() now uses the options of a field to display in the list.
  • RowsAffected() now works like it should.
  • Fixed the Debug Query to work again.
Its a Recommended Update
Questions or Comments? Feel free to leave them in the PHPSimpl Group. There is always someone to help available. By the way we love feature requests, keep them coming.

Wednesday, June 27, 2007

PHPSimpl 0.8.1 Maintenance Update

Cleaning up after a release.
Thanks to everyone who has been using and testing PHPSimpl. After our first official release we wanted to squash some bugs, here is a list of the updates in 0.8.1:
  • Slightly Updated Example
  • Fixed the form label "?:" issue
  • Better support for tables without a primary key
  • Fixed the SimpleFormat to display values properly and renamed it to Nice()
  • Change DB now counted as a query
  • View() now goes off the default field display first
  • Security Updates related to SQL injection
Its a Recommended Update
Questions or Comments? Feel free to leave them in the PHPSimpl Group. There is always someone to help available. By the way we love feature requests, keep them coming.

Friday, May 11, 2007

PHPSimpl 0.8.0 Final Released

Everybody Dance! PHPSimpl has reached its 0.8 release!
We have been working hard the last few weeks to get PHPSimpl release worthy and the day is finally here! Included in the release are:
  • SetOption now accepts objects
  • Compressed the JS and CSS for the calendar
  • Change the time fields to human readable format
  • Fixed issue with Save() and display_order
  • Minor bug fixes
  • A more robust example
  • Full documentation for the classes with final API's
Want to try it out?
Questions or Comments? Feel free to leave them in the PHPSimpl Group. There is always someone to help available. By the way we love feature requests, keep them coming.

Thursday, April 26, 2007

PHPSimpl 0.8.0 RC1 Released

PHPSimpl 0.8.0 is feature complete and is posted on Google Code. The release candidate will be up for about a week and we will not be adding any more features or API changes. We are only concerted with bug fixed and security issues. Please download it if you are interested in giving it a try and let us know what you think. The final will be out in about a week and we are hoping to have a more feature complete example in it.

The Links
Please submit any bugs to the Issue List.

Wednesday, April 18, 2007

PHPSimpl 0.8.0 Beta 1 Released

The first beta PHPSimpl has been released to the public. You may be wondering why we decided to start at 0.8, well we have put together a Version History in the wiki and also a short Road Map. We have been using some form of a DbTemplate at WSU for a while now it just has not been public. Over the past two years it has continued to grow and strengthen. After submitting it to google code initially we knew it still needed some work and we took on the challenge of creating a solid framework that could be easily implemented and rapidly create applications with minimal configuration.

The Links
Remember this is just a beta, there is still some polishing to do. Although it is working this is still considered Beta software. Please submit any bugs to the Issue List.

Tuesday, April 17, 2007

Multiplication

The MultiForm() function is here. It allows an entire form or just one form field to be displayed with the [] brackets on the end of the input name. This allows the form to have multiple copies of the same fields in the same form without anything getting overwritten or any additional setup.

Here is how it is used:
// Create the Address
$myAddress = new Address;

// Get a list of all their addresses
$myAddress->SetValue('customer_id', $myCustomer->GetPrimary());
$myAddress->GetList();

// Display all their current addresses
if (count($myAddress->results) > 0){
foreach($myAddress->results as $address){
$myAddress->ResetValues();
$myAddress->SetValues($address);
$myAddress->MultiForm();
}
}
Here is the output:

Sunday, April 08, 2007

A More Centered API

Its been a while but we have been working hard on an API that is going to withstand the test of time. This will make Simpl more expendable and not require as many application code level changes in the future.

These function have been added to the Form() Class:
SetDisplay($fields) -> Boolean
SetHidden($fields) -> Boolean
SetOmit($fields) -> Boolean
SetOptions($options) -> Boolean
SetConfig($config) -> Boolean
They can make the DbTemplate and Form classes a lot easier to work with. Here is an example of how to declare a class with these new functions:
class RSVP extends DbTemplate {
/**
* Class Constuctor
*
* @param $data array
* @return null
*/
function __construct($data=''){
// Setup the required fields
$required = array('first_name', 'last_name', 'email', 'phone', 'is_attending');
// Setup their labels
$labels = array('first_name' => 'First Name', 'last_name' => 'Last Name', 'email' => 'E-Mail', 'is_attending' => 'Attending');
// Setup the examples
$examples = array('email' => 'name@domain.com');

// Call the Parent Constructor
$this->DbTemplate($data, $required, $labels, $examples, 'rsvp', '', 'my_database');

// Set the Display
$display = array('first_name', 'last_name', 'email', 'phone', 'is_attending');
$this->SetDisplay($display);

// Add a validation Type
$this->Set('validate','homepage', 'url');

// Set the defaults
$defaults = array('is_attending' => 1);
$this->SetDefaults($defaults);

// Set the Options
$options = array('is_attending' => array('1' => 'Yes', '0' => 'No'));
$this->SetOptions($options);

// Set the Config
$config = array('is_attending'=>'radio');
$this->SetConfig($config);
}
}
Now the display and the config information follow the class where ever it is used. Also the default values can be used to set up the form before the user enters any information.

Example of this being used on the page:
// Create an RSVP Instance
$myRSVP = new RSVP;

// Display the form
echo '<form>';
$myRSVP->Form();
echo '<input name="submit" value="Save" type="submit">';
echo '</form>';

Sunday, February 18, 2007

Simpl API Documentation

So we started to document the Simpl API, which is quite a large task since we did not start the documentation process tilll the API was almost complete. Although Simpl has almost full JavaDoc documentation throughout the source it is a pain to open up the source every time you need to look up the parameters to a function call. So we started to document all the classes, functions, examples of their use and return values at the projects homepage wiki. Most of the classes are in there now and more will be added shortly. If you would like to contribute to the documentation effort just let me know and I can add you to the list.

Wiki:
http://code.google.com/p/phpsimpl/w/list

Base Classes:
http://code.google.com/p/phpsimpl/wiki/BaseClasses

New Simpl caching system

It has been a little bit but a few things have happened in the past month or so. We implemented a new caching system that will speed up the saving and retrieving of table cache to the filesystem. There is no change in the API, the only thing that you will notice is that the cache now has a "table_*.cache.php" naming format. This was changed to distinguish it from the other caches that have been implemented in the past month.

The other caching that has been implemented is the query cache. This is a simple system that is enabled by a boolean define named "QUERY_CACHE", if it is set to true every time a "SELECT" query comes through $qb->Query() it saves its results to a file. So next time the same query comes around there is no need to re-query the database for the same information it is already available in the cache. This query will stay in cache till $db->Perform() is called which at that time all the query caches are cleared out. We have found this is a significant increase in performance for large queries that require a few joins and sorting.

This also brings up the situation where possibly all the queries on the page are found in cache and we got to thinking why even bother connecting to the database unless we really need to. So Simpl now will not connect to the database until the first query comes by that could not be found in cache. We have found that this also improves performance especially if the database is on a separate machine. There is only one downside to this addition, when calling $db->Connect() it will always return true since it just stores the database information and waits for the first query, you will no longer be able to check on connect if the database is available or not, it will always look available.

The last functionality that was added was the deprecation of the "CLEAR_CACHE" define. Currently it is still working for backwards compatibility but will soon be removed. It has been replaced by the use of a GET variable that can be used on any page. There are two that will be able to clear specific caches and one that will clear all the caches.
page.php?clear -> Clears all the caches (table and query)
page.php?clear_query -> Clears just the query cache
page.php?clear_table -> Clears just the table cache
You can call these GET variables on any page that creates the "mySimpl" class and the cache will be cleared.

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.