Planet CMS Code
Brought to you by:
tehhector
| File | Date | Author | Commit |
|---|---|---|---|
| admincp | 2011-10-10 | tehhector | [r12] |
| libs | 2011-06-06 | tehhector | [r10] |
| media | 2011-05-23 | tehhector | [r4] |
| modules | 2011-05-23 | tehhector | [r4] |
| shared | 2011-05-23 | tehhector | [r4] |
| template | 2011-05-23 | tehhector | [r4] |
| .htaccess | 2011-05-23 | tehhector | [r4] |
| 404.html | 2011-05-23 | tehhector | [r4] |
| README | 2011-05-23 | tehhector | [r4] |
| configuration.php | 2011-05-23 | tehhector | [r4] |
| database.sql | 2011-06-06 | tehhector | [r10] |
| index.php | 2011-06-06 | tehhector | [r10] |
*Variables:
-Front End
URL : the site url without a trailing slash (/) eg: http://mysite.com
DIR : the site directory without a trailing slash (/) in *nix eg: (/var/www) or backslash (\) in windows eg: (c:\wamp\www)
DS : Directory seperator (\) in windows, (/) in *nix
-Back End
AD_URL : admincp url without a trailing slash (/) eg: http://mysite.com/admincp
SITE_URL : the site url without a trailing slash (/) eg: http://mysite.com
AD_DIR : the admincp directory without a trailing slash (/) in *nix eg: (/var/www/admincp) or backslash (\) in windows eg: (c:\wamp\www\admincp)
SITE_DIR : the site directory without a trailing slash (/) in *nix eg: (/var/www) or backslash (\) in windows eg: (c:\wamp\www)
DS : Directory seperator (\) in windows, (/) in *nix
*Functions:
-Database:
The database Class called database
to create new object: $db = new database;
to open connection: $db->connect();
to close connection: $db->close();
-Select:
-Select One Row:
$db->query(YOUR SQL);
this will assagin the $db->affected_rows var to the number of records
if($db->affected_rows){
$result = $db->fetch();
}
-Select More Than One Row:
$result = $db->fetchArray(YOUR SQL);
this opertaion will return an array.
-Insert:
the data to be inserted should be presented as an array, the key for the coloum in the table and the value.
eg:
$data = array('name' => $name, 'phone' => $phone);
$db->insert(TABLE_NAME, $data);
the return value will be the id on the inserted row if the operation was a success, 0 in case on failure
-Update:
the row to be updated should be presented as an array, the key for the coloum in the table and the value.
eg:
$data = array('name' => $name, 'phone' => $phone);
$db->update(TABLE_NAME, $data, "id='$id'");
the first param is the table name, the second param is the data array, the third is the conditions.
the return value will be the id on the inserted row if the operation was a success, 0 in case on failure
-Delete:
$db->query(YOUR SQL);