Exploring a New Application
Once an application is created using the Istarel Workshop Application Framework installer, a series of initial directories and files are created.
Directory Listing: /iw/
conf/ ApplicationConstants.php httpd.conf img/ index.php lib/ rsrc/ ApplicationDelegate.php ApplicationSecurityDelegate.php Home.php log/ model/ page/ DefaultPage.php html/ index.html
In addition to a default Home page, the installer creates an ApplicationDelegate and ApplicationSecurityDelegate. The former serves several purposes, the foremost of which is to help the application framework find modules. The latter controls the way in which security is applied to the application.
Page Rendering
One method in the ApplicationDelegate is called startingPoint() and returns the Module that should be in control absent a more specific request in the URL.
function startingPoint( ) { return 'Home'; }
Since http://localhost:8080/iw
does not include a module name, the application framework defers to the starting point identified in the ApplicationDelegate. (In general, the ApplicationDelegate's role is to provide answers when the framework gets confused or does not want to "guess" the application's intent.)
Listing: /iw/rsrc/Home.php
class Home extends IWModule{ function pageClass( ) { return 'DefaultPage'; } function pageTitle( ) { return 'Home Page for Istarel Workshop'; } function pageDidLoad( $page) { $body= $page-> body( ) ; $body-> addElement( new IWNonreplacedElement( 'h2', 'Istarel Workshop') ) -> addElement( new IWParagraphElement( 'This application is being built with the Istarel Workshop Application Frameworks.') ) ; } }
The optional pageDidLoad() method is called by an IWPageController instance after the page templating is complete. Thus, it provides one last chance for the active module to intervene before the page is rendered.
Multiple Rendering Mechanisms
The default page created as part of the application installation illustrates only one mechanism for placing content on a page. As development of Istarel Workshop (and other applications) continues, I will be illustrating many other techniques for page construction.