PHP
  Home arrow PHP arrow Page 5 - Template-Based Web Development With pa...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Template-Based Web Development With patTemplate (part 2)
By: Team Melonfire, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 10
    2002-06-19

    Table of Contents:
  • Template-Based Web Development With patTemplate (part 2)
  • Scoping It Down
  • Speaking In Tongues
  • Looping The Loop
  • Legal Eagles
  • Hide And Seek
  • Setting Things Right
  • Fortune Favours The Brave
  • Running On Empty
  • Simple Simon
  • Brain Dump
  • A Well-Formed Example
  • Crash Bang Boom
  • Endgame

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Template-Based Web Development With patTemplate (part 2) - Legal Eagles


    (Page 5 of 14 )

    You can source an external file into your template via the "src" and "parse" template attributes. Let's suppose I have a copyright notice, stored in the file "copyright.txt", which looks like this:


    Everything here is copyright Melonfire, 2002. Be good. We have lawyers.
    I can source this file by attaching the "src" attribute to a template,

    <patTemplate:tmpl name="copyright" src="copyright.txt" />
    and tell the engine whether or not to parse the sourced file for template variables with the additional "parse" attribute.

    <patTemplate:tmpl name="copyright" src="copyright.txt" parse="off" />
    Once that's done, I can call this template from within another template, like this:

    <patTemplate:tmpl name="main"> <html> <head> <basefont face="Arial"> </head> <body> This is my Web site. It has lots of interesting stuff on it that you might want to use for your own nefarious purposes. But before you do, read the notice at the bottom of this page. <p>&nbsp;<p> <hr> <patTemplate:link src="copyright" /> </body> </html> </patTemplate:tmpl>
    And now, when I parse and display the "main" template, the external file "copyright.txt" will be read and incorporated in the final output by the template engine. Here's what it looks like:

    More PHP Articles
    More By Team Melonfire, (c) Melonfire


     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway