Optimalworks Ltd web design, SEO, training and consultancy 

the site completely surpassed my expectations GT, AutoDirector, we build websites that work, my website is great - I love it MP, XL Autos, reach more customers, make more sales, it's more than I ever could have expected LM, Trade Cars UK, we can help your business grow, 99% of business now comes from my website GV, Bash Events, promoting standards throughout the web industry, your contribution added a level of quality we would otherwise have struggled to achieve PS, Hemsley Fraser
  1. home
  2. Services
  3. Portfolio
  4. Contact us
  5. blog

TACS – free PHP template and caching script

written by craig, 21 June 2007

There are many good PHP templating systems available. However, some are very complex or require learning API commands rather than using your own PHP libraries.

This was the inspiration for TACS (Templating and Caching System). I wanted a simple system that allowed us to:

  • easily include other files, such as headers, footers, etc.
  • easily create and use variables
  • cache and compress the HTML
  • use my own PHP code for functionality
  • specify PHP code blocks that output static HTML when the page is cached, e.g. processing arrays to create HTML menus
  • specify normal PHP that runs every time the page is loaded, e.g. form processing, database connectivity, etc.

TACS provides these facilities and should work on any OS and web server that supports PHP4 or above.

To use TACS, include it at the top of your PHP page: <?php require_once('relative_path_to_tacs/tacs.php'); ?>

All TACS instructions are enclosed in double square brackets; [[command]]. To include a template file, use: [["path/template.tpl"]]

You can also set and display variables: [[title = "Page title"]] <h1>[[title]]</h1>

If a PHP code block is enclosed in double square brackets, it will be executed when the page is cached and its output is stored as static HTML. It can also use TACS variables – just add a $ to the variable name, e.g. [[title = "Page title"]] <-- cache the following output as static HTML --> [[<?php echo "<h1>$title</h1>"; ?>]]

(Note that PHP code in the main file that has the require_once are always cached whether it is enclosed in square brackets or not).

Finally, normal PHP within included files is run every time the page is loaded, e.g. <?php echo date('Y-m-d H:i:s'); ?>

We use TACS for many of our sites. Pages can be developed quicker, the code is cleaner, they are easier to maintain, and downloading is faster.

Interested?… Download TACS (12 Kb). You are free to use, modify, or distribute the software. An acknowledgment and link back to optimalworks.net is all we ask, but feel free to make a donation!

  • categories: free download, php
  • tags: download, php, software
  • trackback: http://www.optimalworks.net/blog/2007/software/free-download/tacs-php-template/trackback
  • bookmark: del.icio.us, digg, facebook, twitter, reddit, Furl, Spurl, Blinklist, Slashdot, Technorati, Yahoo!
add your comments
please enter your name
please enter your email address - it will not be published anywhere
please enter your website address
please enter your comments (all are moderated and checked for spam)

  • next article: Using CSS to create Vista-like Aero effects 
  • previous article: JavaScript console for Safari on Windows 
search
  • all popular (5)
  • courses (1)
  • general (4)
  • hardware (1)
  • software (31)
    • blogs (1)
    • free download (8)
    • web browsers (12)
    • web servers (2)
  • web development (42)
    • accessibility (4)
    • ajax (1)
    • css (3)
    • graphic design (4)
    • html (1)
    • javascript (11)
    • php (5)
    • seo (2)

tags

  • accessibility
  • ajax
  • analytics
  • apache
  • award
  • book
  • chrome
  • computing
  • css
  • design
  • developers
  • dom
  • download
  • editor
  • emulation
  • firefox
  • funny
  • google
  • graphics
  • hardware
  • html
  • ie
  • javascript
  • opera
  • php
  • png
  • portfolio
  • review
  • ruby
  • safari
  • security
  • seo
  • server
  • software
  • spam
  • ssl
  • standards
  • wordpress
  • xml
  1. site map
  2. home
  3. Services
  4. Portfolio
  5. Contact us
  6. blog
  7. RSS feed
  8. project survey

XHTML 1.0 | CSS 2.1 | WAI AAA | printer-friendly

©2012 Optimalworks Ltd, Devon, UK. Registered in England and Wales No. 5922205.

This page can be viewed at http://www.optimalworks.net/blog/2007/software/free-download/tacs-php-template