Prithvi Information Solutions Web Software development Development Decoded
Home Products Allmostapp Testimonials About Us
one pix | |
Celeroo Frame Manual   FAQ
Getting Started
Basic Concepts 
URL Routing 
The Administration Dispatcher
Libraries and Helpers Reference
The Simple GuestBook MVC Example
FAQ
 
Download Celeroo Frame
A flexible PHP framework
 
 
Q. How to handle PHP Session in Celeroo?
A. Celeroo Frame works with standard PHP sessions (i.e., $_SESSION) variable. No need to use any specific class.
Q. Can I use mysqli instead of MySQL to use Celeroo Frame?
A. Celeroo Frame uses standard mysql extension, to switch from MySql to mysqli, rewrite the db_wrapper class.
Q. Is it compulsary to use database to store variable SITE_URL??
A. Celeroo is expected to be used with a database, therefore it comes with a default settings table which allows you to set the SITE_URL constant. The same setting mechanism can be used for setting and managing unlimited number of constants.

However this is not at all required if you don't want it. You can remove/comment the part that retrieves the settings from defines.inc.php and use hardcoded define() for the site URL
Q. When I click on the "Leave your Message" link it goes to the following link and produce error
http://localhost/celerooframe/<? echo SITE_URL?>post/
A. Please replace short_open_tag = Off with short_open_tag = On in the php.ini file
Q. When I try to add a new message it shows " Fatal error: Call to undefined method Guestbook::add() in C:wampwwwcelerooframecontrollerspost.php on line 36"
A. a) Please make sure all function definitions are within the class.
  b) Make sure that you have $guestbook=new Guestbook(); in post.php as shown in the documentation example.
Q. How would you go about altering the Guestbook example if you wanted the link for "Leave Your Message" to populate another area on the same page with the form for posting a message?
A. To get only the output from the Ajax script, Instead of $view="views/.....html", let the Ajax controller just require the desired view (or if the output is simple, you can just use echo / print) and then exit.

Examples of the Ajax controller:

1. require("views/some_view.html");
exit;

2. echo "Some Ajax response some html";
exit;

This way the master won't be loaded.
Q. I am using windows..I dont know to Change the mode of inc/folder to 0777 which was given as a step in celeroo.com. I had tried both http://localhost/celerooframe/install.php and http://localhost/celerooframe/index.php...but I am getting object not found message
A. a) chmod 0777 is not required on windows.
  b) For "object not found" message, check if mod_rewrite is enabled in XAMPP or not. If not, enable by following these steps:

file location : "xamppapacheconf"
file name : "httpd.conf"

search for "LoadModule rewrite_module modules/mod_rewrite.so"
take out the "#" before the above statement and save your file and restart the "xampp" (double click "xampp_restart.exe").
Q. Can you give sample code for search, insert, update and delete records from a database.
A.

The objects in Celeroo provide simple methods for insert, update and delete:

  INSERT:
$object->add($vars);
where $vars is associative array of DB fields and their values. You can pass the pair manually, for example:
$guestbook->add("name"=>"John", "content"=>"My guestbook entry");
But if you have data from web form whose field names match the table field names, you can just send $_POST:
$guestbook->add($_POST);
so you don't need to type the fields. Any fields in the form that don't match table field names will be ignored.
  UPDATE:
Pass the ID of the row you want to update:
$object->edit($vars,$id);
If we use the guestbook example, it can be something like this:
$guestbook->edit($_POST,$_POST['id']);
  DELETE:
call delete():
$object->delete($id);
  SEARCH:
There are three options:
- to run SQL queries directly
- to use the find() method
- to extend the inherited find() method.
 

The find() method (public function find($key=0,$options=NULL)) provides three ways of searching:

$object->find($id) will return a single associative array of the record matching the given ID.

Example: $message=$guestbook->find($_GET['id']);

$object->find(array("field"=>"some_field", "value"=>"some value")); will return single associative array based on field/value pair that you choose.

Example: $user=$user_object->find(array("field"=>"email", "value"=>"john@yahoo.com"));

There are ways to retrieve multiple records. Calling find() without any parameters returns all the results in the table paginated with the total count.

Example: list($users,$count_users)=$user_object->find();

Thus in $users you will have all the records and you can use foreach, for or other operator to iterate through them. In $count_users you will have the total count that might be needed for pagination function or anything else.

If you don't want paginated content or want to add conditions, you can pass parameters to the find() method. To receive such multiple values you need to pass 0 to the first parameter and then array of conditions.

Examples: a) list($users, $count_users) = $object->find(0, array("page_limit"=>20));

will return all users but paginated by 20 instead of the default PAGE_LIMIT setting.

b) list($users, $count_users) = $object->find(0, array("conditions"=>" gender='male' AND age>18 "));

will return males above 18 years.

The $options array allows passing also: 
- "offset" - the offset for pagination, if such is not provided the system will try to find $_GET['offset']
- "orderby" - defaults to "id"
- "orderdir" - defaults to "ASC"

Finally, if you don't want paginated results and total count, you can pass -1 as "page_limit" to get only an array:

$rows=$object->find(0,array("page_limit"=>-1));

Example: $users=$user_object->find(0,array("page_limit"=>-1));

Who We Are | Contact Us
All Rights Reserved. Copyright © 2008 - Prithvi Information Solutions Limited.