• News
  • Developer information
  • Projects & contributions
  • Forum
  • Issue tracker
  • Open Funding
  • Security
  • User groups
  • Support
  • Store
  • Company

  • Path

    ez.no / exponential / documentation / development / scripting / supplied scripts / template compiler


    Template compiler

    These documentation pages are no longer maintained. Please visit the new documentation site.

    The template compiler script allows for compiling all templates belonging to a given siteaccess.
    Using this is quite important when getting the site ready for going live since it will remove the need to compile the template the first time they are accessed.

    The script resides in bin/php and must be run on each siteaccess for your site.
    It is also very important to set the parameters correctly, if unsure consult the examples.

    Compilation vs caching

    Template compilation and view caching are two different things.

    Compilation is is done once for a template (per siteaccess) and will not require recompilation unless the template is modified.

    Caching is way to speed up viewing of objects and will usually be regenerated multiple times on a site regardless of the template.

    Clearing all cache?

    Currently the compiled templates are placed in the cache directory.
    This means that if you run the clearcache script (with --clear-all or --clear-tpl) or removes the cache directory the compilation process is done once more.

    Basic usage

    Run the bin/php/eztc.php script with the -s parameter which defines the siteaccess to compile.
    The script will then figure out all design from that siteaccess, find all templates and compile them.

    The syntax is

    ./bin/php/eztc.php -s SITEACCESS
    
                      --www-dir=PATH
    
                      --index-file=INDEX
    
                      --access-path=ACCESS
    
                      FILE...
    • SITEACCESS - The name of your siteaccess
    • PATH - The path before the index.php or the Exponential site starts, usually empty.
    • INDEX - The name of the index file or empty if using virtual hosts and rewrite rules.
    • ACCESS - The name of siteaccess in the path of the url, this is only required if siteaccess is specified in the url.
    • FILE - Only compiled given template file, multiple files are possible.

    Note: The FILE argument is available from 3.5 and up.

    Reruns

    If you run the compiler script again it will only compile the script which has been modified.
    If you want to recreate all templates you must first clear them with.

    ./bin/shell/clearcache.sh --clear-tpl

    Forcing recompile

    By passing the --force parameter you can force the recompilation of all templates.
    Combining this with a specic template file can be used to recompile a specified file.
    For instance if you are modifiying a subtemplate (tool or menu for instance) of some kind that is used in pagelayout.tpl you can recompile pagelayout.tpl to get it updated.

    Note: This is available from 3.5 and up.

    Examples

    All examples has example_user as user siteaccess and example_admin as admin siteaccess.

    Virtualhost example

    User site:
    
    http://example.com/
    
    Admin site:
    
    http://admin.example.com/

    Run:

    ./bin/php/eztc.php -s example_user
    
    ./bin/php/eztc.php -s example_admin

    Virtualhost + path example

    User site:
    
    http://example.com/mysite/
    
    Admin site:
    
    http://admin.example.com/mysite/
    ./bin/php/eztc.php -s example_user --www-dir='/mysite/'
    
    ./bin/php/eztc.php -s example_admin --www-dir='/mysite/'

    Virtualhost + url siteaccess example

    User site:
    
    http://example.com/user/
    
    Admin site:
    
    http://example.com/admin/
    ./bin/php/eztc.php -s example_user --access-path='user'
    
    ./bin/php/eztc.php -s example_admin --access-path='admin'

    Non-Virtualhost example

    User site:
    
    http://example.com/index.php/
    
    Admin site:
    
    http://admin.example.com/index.php/
    ./bin/php/eztc.php -s example_user --index-file='/index.php'
    
    ./bin/php/eztc.php -s example_admin --index-file='/index.php'

    Non-Virtualhost + path example

    User site:
    
    http://example.com/mysite/index.php/
    
    Admin site:
    
    http://admin.example.com/mysite/index.php/
    ./bin/php/eztc.php -s example_user --www-dir='/mysite' \
    
                      --
    index-file='/index.php'
    
    ./bin/php/eztc.php -s example_admin --www-dir='/mysite' \
    
                      --
    index-file='/index.php'

    Non-Virtualhost + url siteaccess example

    User site:
    
    http://example.com/index.php/user/
    
    Admin site:
    
    http://example.com/index.php/admin/
    ./bin/php/eztc.php -s example_user --access-path='user' \
    
                      --
    index-file='/index.php'
    
    ./bin/php/eztc.php -s example_admin --access-path='admin' \
    
                      --
    index-file='/index.php'

    Full Non-Virtualhost example

    User site:
    
    http://example.com/mysite/index.php/user/
    
    Admin site:
    
    http://example.com/mysite/index.php/admin/
    ./bin/php/eztc.php -s example_user --access-path='user' \
    
                      --
    index-file='/index.php' --www-dir='/mysite'
    
    ./bin/php/eztc.php -s example_admin --access-path='admin' \
    
                      --
    index-file='/index.php' --www-dir='/mysite'

    Comments

    Contents

    Development

    Extensions
    Exponential datamodel
    Exponential tuning and stability
    Importing attribute data
    Kernel
    Libraries
    Scripting
        Script classes
        Supplied scripts
           Database Diffing Tool
           Template compiler
           Update search index
           Update remote ID
        PHP CLI
    Standards
    System overview
    Test Suite
    Using Doxygen to create API documenta...


    Created

    11/06/2004
    3:01:21 pm
    by Jan Borsodi

    Last updated

    16/06/2004
    11:00:03 am
    by Jan Borsodi

    Authors

    Jan Borsodi



    This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.