Each Tangra based site contains 3 major hierarchical levels of components:
In the figure above arrows represent depends on relation.
From processing point of view sequence is:
In above figure actions in the left side happens on users machine / browser. Actions in the right happen on the server (Apache, PHP, your site).
Let's traverse this sequence step by step with more details:
User request page index.php
User just types in his / hers browser's address bar something like tft.somehost/index.php. Browser does its internet magic and finally connects to the web server and requests the page index.php. Nothing unusual.
Apache runs PHP which runs index.php
Apache handles the request by running using PHP index.php which is found in /htdocs directory in your site. Such files, in Tangra context are called interceptor files. Their purpose is to intercept the request and handle it by loading site's and page's functionality. In order to load the site's functionality boot is performed which means that framework is initialized and global variable $SITE is populated with object inherited from Web_Site.
index.php boots the site
For more detailed explanation please see Chapter 8, Boot process
Index.php loads and creates object of type Index_WP class
Each page in Tangra based site is represented by two files: the interceptor file and the WP file which contains actual functionality of the page.
Site runs Index_WP object, Index_WP creates view object, processing, returns view object
Each web page (WP file) must at least define init() method where view is created. Usually you will want to overload run() method in order to provide some additional page functionality (in case of WED page you will have to define method for each event). nevertheless each web page must return object of type Web_Page_View.
Site tells to the view to show its output; View finds Tpl file for the page and compiles it using tple; View sends HTML to the output buffer; Apache sends HTML to the browser
One of the major modules in Tangra framework is tple_smarty which provides a wrapper around » Smarty template engine. Descendants of Web_Page_View class are responsible for formating the output either within their methods, either when processing Tpl file using template engine (recommendable). Resulted HTML is fed into PHP's output buffer which on its turn is sent to Apache and then to visitor's browser.