PHITE: Elements

Home

> Quick Start
> Basic Concepts
        • Elements
        • Blocks
        • Content Snippets
        • PHITE Environment
        • Other Features
        • Security
> Code Examples
> Tool Examples
> Choose Skin
> Contact Me
> Help
> Credits
> Downloads
> PHITE Sites

Links
PHP
TemplatePower
ZOPE
HotScripts
ScriptSearch

Phite (GitHub)
PHITE is now listed on GitHub


Elements

PHITE pages are built up by snippets of content automatically being inserted into the site template. Snippets come in two basic types, elements and blocks.

Elements are snippets that have a single value or content on the page. These elements are used in the .tpl template file between braces thus: {PAGENAME}. Whenever {PAGENAME} is encountered in the .tpl file it is replaced with the contents of the element PAGENAME for the current page.

Built-in Elements included in PHITE are:

  • SITENAME: The name of the current site;
  • PAGENAME: The name of the current page (or sub-page);
  • HOMELINK: The URL to the Home Page;
  • HOMENAME: The name of the Home Page.
You do not need to do anything to use these, they are generated automatically. Just include the element names in braces in your .tpl file where you need them.

Defined Elements are defined in the 'Settings' section of the script. The standard distribution of PHITE includes the following defined elements:


  $elements['BODY']   = array('el_name'=>'BODY',   'acq'=>true); 
  $elements['FOOTER'] = array('el_name'=>'FOOTER', 'acq'=>true);
  $elements['META']   = array('el_name'=>'META',   'acq'=>true);
  $elements['DATE']   = array('el_name'=>'DATE',   'acq'=>true);
  $elements['PRINT']  = array('el_name'=>'PRINT_FRIENDLY', 'acq'=>true);
For example, let us take the BODY contents element. The code will look in the current page/subpage directory for a file called BODY.inc or BODY_any_arbitrary_text.inc. The contents of the file found will be substituted for the element {BODY} in the .tpl template file being used. Note that the 'signature' (e.g. 'PRINT') and the entry in the .tpl file (e.g. {PRINT_FRIENDLY}) may have different names.
The above defined elements should form a good starting point for a site. You can easily add your own as needed.

Acquisition. The final flag 'acq'=>true (or false) tells PHITE what to do if the file is not found in the current page or subpage directory. If 'acq' is true, then it will look to see if it can be found in the containing page or in the {sig}_MAIN directory. For example, the element 'PRINT' is set by placing a file in the {sig}_MAIN directory and it is used in the whole site if no other PRINT.inc (or PRINT_somename.inc) files are in any of the pages or subpages.

Box Example
This is the Right box for the Basic Concepts page. It appears because there is a file called RB_001_Box_Example.inc with this text in it, in the directory PT_003_Basic_Concepts.

 
Chris Robson 2002, Tom Brennfleck 2009
Privacy        Disclaimer
Online: 1    Today: 1    Total: 73,840
Powered by Phite