Navigation:  "The Jet Engine" PHP Application Framework > Quick Tour >

Program FLow

Previous pageReturn to chapter overviewNext page

At it's heart, The Jet Engine is an "MVC" (Model View Controller) PHP Framework

 

On every page request, here's what happens:

 

Main program file fires up and parses the URL to determine what it's got to do.
i.e. http://www.yoursite.com/blog/article/id/4/show_comments/1/
The first paramater ("blog") is the "controller" (which application to run)
The 2nd paramater ("article") is what action to take.
Following, are name/value pairs that the controller will use.  In this case, the "id" is "4" and "show_comments" is set to "1"
 
Now, we know what application we've got to run (blog),  The Engine will now load the library files:
/lib/applications/blog/application.php and /lib/applications/blog/plugins.php
If you have other includes or requires in those files, they'll be loaded at this time as well.
 
If your application needs to connect to the SQL Database, that connection is made.
 

 

The "Controller" is fired up.

Once connected, your application is initialized (it will call your __constructor() function or object name function ("blog()" in this example)
 
If an action has been specified, that method will be run ( in this case, the program will run $blog->article() )
Typically, the action methods within the controller will access various Data Models to perform actions on, or simply to read in order to get their data.
The controller action method will also typically merge this data with Sub-Templates (Views) to create HTML output without actually defining any HTML on their own.
Any HTML output that it creates or generates will be returned to the application and will be saved for later.
 

The "View" (page layout) is rendered.

The program will attempt to load a page layout, based again on the "action" requested by the user.  If there's a defined page layout matching both the "controller" and the "action" (ie, /layouts/blog/article.html in our example), it will be used, otherwise "index" (/layouts/blog/index.html in our example) will be used.
 
This template is then scanned for "PLUGIN" tags.  When found, functions in the "plugins.php" file are sought that match the plugin tags.  For example, finding <!-- PLUGIN:TITLE --> in the page layout will make the system look for a function called "title()".
 
Once all of the plugin tags have been identified and their associated functions have been run, the View Object will merge the page layout with the plugin output, and replace all of those PLUGIN tags with the actual output that it got from running those named functions.
 
This merged page is then rendered to the browser.

 

 

That's pretty much it.   The program loads the appropriate controller, runs the specified action, and sticks all of it's output into your template, where you specified for it to go.  Done.


This help file was created with an unregistered evaluation copy of Help & Manual. © EC Software. All rights reserved. This message will not appear if you compile this help file with the registered version of Help & Manual.