Frontend Generation
As the frontend uses the same database as the backend, you have all objects readily available for use in your application. Let's take a look on the code flow:
When a user visits your frontend webpage, he will be redirected to the file frontend/frontend.php via .htaccess. In frontend.php, all needed objects (such as the Smarty engine) are initiated. Another part of this file is the creation of a special $GET array by calling the clearGet() method of the frontend class. This function splits the current URL string into different parameters and pushes them into the array. Per default, a spunQ frontend URL fits the following schema, which simply can be changed by editing the clearGet() method:
http://www.yourdomain.com/action/class_id/parent/oid/version/page/errorcode
(Of course, not all parameters have to exist.)
Afterwards, the main event handler is included, where the whole frontend is controlled. This file is named [your_project_name].php. The one which belongs to the spunQ website and is placed in the tarball as an example therefore is the file frontend/spunq.php.
The event handler mainly consists of a switch/case construction which takes the $GET['action'] as argument. This means that you will have to place your start page actions in the “default” branch of the switch/case structure as at this point no action will be defined.
Most methods you will need to get content out of the database can be found in the built-in frontend class (frontend/classes/frontend.class.php). The most used ones are getTextById() which returns the metadata of an object and getStructureObjects() which returns the objects existing within a folder. (For detailed descriptions of most frontend methods, have a look at chapter 5.4.)
After the switch/case construction, some general Smarty variables such as the POST array or the current URL are defined via $smarty->assign(“NAME”, $value).
Finally, $smarty->display(“index.tpl”) is called to generate the output to the client.
Tags
TechnicalRelated Subjects
>> General Information about the Frontend>> Backend and Frontend
>> File Structure - Frontend
>> Smarty Template Structure
