| Home Register Memberlist Help Search Quick Links Advertise |
| Guru Forum - Aliro, PHP, Mambo, Joomla, ... » Aliro » Aliro templates » Template base class to ease development |
![]() |
![]() |
|
Thread Tools | Display Modes | ![]() |
|
#1
|
|||
|
|||
|
To simplify the development of templates for Aliro, I've written a base template class so that all standard logic can be removed from actual templates. The base class is used by writing a template as a class that extends aliroUserTemplateBase (or on the admin side, aliroAdminTemplateBase).
For anyone who has a basic understanding of Mambo or Joomla templates, the key thing to Aliro templates is that screen areas are actual objects instead of being merely names. Screen areas relate to things that might be more familiar as "left", "right", "banner" etc. It is the template's responsibiity to define the key parameters for the screen areas - the base class will create the actual objects. Building on the greater functionality of screen areas, a call is made to the template as module output for a particular area is being pieced together. Older systems have included code in the core that wrapped HTML around each individual module's output, with choices determined by parameters. This seems the wrong approach when the template should have complete freedom to determine what HTML should be wrapped round module output. Aliro aims to avoid building HTML into the core, especially where styling is involved. So the call to wrap (or do nothing) for each module is to a template method that has a suffix matching the information in the screen areas table created by the template. That is, the template decides which of its own methods should be called for modules in each of the screen areas defined by the template. Doing it is easier than saying it! A shift of emphasis in terms of Aliro best practice is that I strongly believe that screen areas should have functional (not positional) names, such as "navigation" rather than "left". The reason for this is obvious - there are plenty of templates that implement the "left" screen area towards the right hand side of the screen! To illustrate the result, here is the latest code for the Aliro template derived from Water & Stone: PHP Code:
|
|
#2
|
|||
|
|||
|
"A shift of emphasis in terms of Aliro best practice is that I strongly believe that screen areas should have functional (not positional) names, such as "navigation" rather than "left". The reason for this is obvious - there are plenty of templates that implement the "left" screen area towards the right hand side of the screen!"
A splendid idea! Moreover about footer: <!-- copyright notice --> <div id="copyright"> <div align="center"><br />{$this->version->footer()}</div> </div> why not to do as follows: <!-- start footer copyright box. --> <div id="footer"> {$this->screenarea['copyright']->getData()} </div> Then I think it'b be better to choose the name of BOX instead of MODULE. The name ELEMENT instead of COMPONENT, and so on... |
|
#3
|
|||
|
|||
|
Yes, good point, the HTML you quote is pretty horrible! The template now driving the Aliro site is closer to your suggestion, and is currently:
PHP Code:
The suggestion for the term BOX is excellent - I've struggled to find new words and that is one I hadn't thought of. ELEMENT is nice, but I'm not quite so sure about it, since components are pretty substantial things, maybe not fully captured by "element". Also, I have some other ideas about how the architecture should develop - will post again later
|
|
#4
|
|||
|
|||
|
Good news waiting so...
About Box, I like very much this idea. And about Component, I agree with you. The problem is that the right word should be Module as a CMS has its principles in a modularity system, but it's too confusioning for people Mambo born. |
|
#5
|
|||
|
|||
|
just for clarify my ideas, I like the idea of Module instead of component.
|
|
#6
|
|||
|
|||
|
what about Theme (I think more professional) instead of template? (The style is applied by CSS)
|
|
#7
|
|||
|
|||
|
(For this post, I've stuck to old terminology to be consistent with earlier messages in this thread)
The mechanism of providing a base class for template development has been further improved. If you don't want to know about the details of the classes involved, then skip down to the example! There is now a simple structure of classes, starting with the abstract aliroTemplateBase which provides common features for all kinds of templates, including internal templates used by components to structure their area and build the HTML using multiple modules. Inheriting from it is another abstract class, aliroMainTemplateBase which contains common code for user side and admin side templates, but goes beyond what is needed for internal templates. Next down the inheritance scheme are two different abstract classes. One is aliroMainTemplateBase for building user side templates, and the other is aliroAdminTemplateBase (only available on the admin side) for building admin templates. An actual specific template can inherit a number of methods from the parent classes and not bother to implement them at all. OTOH the template is free to override the methods provided and implement them differently. The logic of an Aliro template should be fairly clear from the example. A complete user side template is shown here, and illustrates just how simple it is to create an Aliro template: PHP Code:
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. |
||