Loading...

Downloading data

In order to download data from the data base we have to execute the following steps:
 

1. Table object preparation

From the PHP level, object preparation looks like this:
$pagesDB = new pagesDB();

Where an objects name is a name of a table with DB added at the end.
A variable prepared like this $pagesDB  can be used for sending queries to a data base with the help of our framework.
 

2. Sending inquiry

In order to perform operations on the data base you should use the proper method available for a certain table, for example:
//General methods
//Returns pages with a status equal to 0 and sorts them according to position
$deletedPages = $pagesDB->fetchAll("status=0",'position ASC','*');

//Returns page with an ID number equal to a number transferred in GET under parameter "id"
$page = $pagesDB->fetchRow("id={$this->request->getVariable('id')}");

//Updates position of images
$imagesDb->updateRow(array('position' => $position),"id = {$element['id']}");


//Specific methods for given table
//Deletes main element and its dependents
$pagesDB->deleteTreeItems($this->request->getVariable('id'));

//Downloads a list of ID numbers of pages dependent on pages with an ID number in GET
$children = $pagesDB->getDependentIdListString($this->request->getVariable('id'));

By default this method returns the data in the form on an object, you can change it so that is is returned in table form, however an object is a much more comfortable form.
 
Example of a result of a downloading page inquiry:
//Code will display Us the result
$pagesDB = new pagesDB();
$page = $pagesDB->fetchAll("id=423");
debugger::dprint($page);
Result
Array
(
    [0] => stdClass Object
        (
            [id] => 423
            [parentId] => 390
            [type] => 11
            [status] => 2
            [position] => 4
            [name] => Main Menu
            [content] => 
            [createTime] => 2012-09-02 09:29:06
            [updateTime] => 2012-12-10 00:32:50
            [createIP] => 127.0.0.1
            [updateIp] => ::1
            [urlKey] => menu-glowne-5
            [tpl] => simple_page.tpl
            [title] => 
            [description] => 
            [keywords] => 
            [tags] => 
            [views] => 6
            [date] => 
            [lock] => 0
            [defaultTpl] => simple_page.tpl
            [authorId] => 5
            [rate] => 0
            [ekey] => ppdhyfzknpnt
            [hasIcon] => 
            [hasImage] => 
            [langId] => 390
            [menuCssClass] => 
            [searchable] => 1
        )

)
We provide the methods to execute the inquiry, each of the tables has its own unique method, which in turn uses a set of basic methods. In order to check which method a given table uses, you have to look into the documentation or into a models code.  

3. Basic methods

  • select($where = null, $order = null, $what = '*',$limit = null, $groupby = null, $bindValues = array() )
  • insert(array $data = array())
  • update($column, $value, $where, $bindValues = array() )
  • updateRow($data, $where, $bindValues = array() )
  • deleteRows($where, $bindValues = array() )
  • delete($id)
  • fetchRow($where = null, $order = null, $what = '*', $bindValues = array(), $fetchType = PDO::FETCH_OBJ)
  • fetchAll($where = null, $order = null, $what = '*', $limit = null, $groupby = null, $bindValues = array(),$fetchType = PDO::FETCH_OBJ)
  • fetchTextSearch($searchText,array $columns, $where = null, $order = null, $what = '*', $limit = null, $groupby = null, $bindValues = array() )
  • fetchCount($where = null, $bindValues = array() )
  • fetchCountGroup($groupBy,$where = null,$order = null,$what = '*', $limit = null, $bindValues = array() )
  • fetchSum($sumColumn,$where = null,$order = null,$what = '*', $limit = null, $bindValues = array() )
  • fetchGroup($groupBy, $where = null, $order = null, $what = '*', $limit = null, $bindValues = array())
  • set($id,$column,$value)
  • get($id,$column)

We are continually working to improve Windu CMS!

By visitng the Windu website you will be kept up to date on new developments concerning the CMS.

2014-05-19 00:00:00 Battle Report

Since the release of Windu 3.0 we have we have done a lot of stuff to our CMS. The most important event in the near future will be the upgrade to version 3.1, which means a...

2014-03-25 00:00:00 Windu 3.0 - list of changes

After many months of challenges, new version of our CMS is finally out! We've decided to drop the idea Windu 2.4 and go for 3.0 straight away due to amount of changes...

2013-06-17 00:00:00 Update - Windu CMS rev 1432

New Windu CMS update is available for download at update server! Update includes several changes in our system: Pinning of tabs - allows fast navigation between open...

Buy a PRO license!

Activate loads of add-ons in your windu!

Buy a PRO license