purpose,article,show,BFCTemplate,users,take,f
Quick Search for:  in language:    
purpose,article,show,BFCTemplate,users,take,f
   Code/Articles ╗ |  Newest/Best ╗ |  Community ╗ |  Jobs ╗ |  Other ╗ |  Goto ╗ | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
PHP Stats

 Code: 66,707 lines
 Jobs: 13 postings

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for PHP.
Simple Forum
By Chas Pardee on 6/20


Click here to see a screenshot of this code!Squiggles
By Chas Pardee on 6/20

(Screen Shot)

photo guide
By Chas Pardee on 6/20


Download Script
By YANP on 6/19


Logging IP's
By Klaus Andersen on 6/18


Server Uptime
By Martin C. Conniffe on 6/15


Send a Page/Link to a Friend
By rae the coder on 6/15


Display contents of a directory and include it in a text area
By Daniel Friedman on 6/15


RaSMail
By Alberto Sartori on 6/13


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

A Sample HTML Template using BFCTemplate v2

Print
Email
 

Submitted on: 5/26/2001 5:00:53 AM
By: Christopher Brown-Floyd  
Level: Intermediate
User Rating: By 2 Users
Compatibility:PHP 4.0

Users have accessed this article 4107 times.
 
(About the author)
 
     The purpose of this article is to show new BFCTemplate users how to take full advantage of the template class.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
1) You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for langauges that allow it) freely and with no charge.   
2) You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
    First, I'll begin with a basic HTML file.
    
    
    This is some sample text
    
    
    Now that we've established what a basic HTML file looks like, we can go into making it into a template for PHP. Here's what we need to do:
    Just like about we have our HTML file; however, whereever we want to have dynamic data, we put a template tag like this:
    
    
    
    
    
    Save the above file as "sample.tpl".
    Once the template class is loaded, you can call the tag function for that tag like this:
    // You need to download the template cla
    //     ss for this to work.
    include("templateclass.php");
    $template = new template();
    $template->usetemplate("sample.tpl");
    $template->tag("MyTag","This is some sample text.");
    $template->display();
    ?>
    Save the above as "sample.php".
    When you run the above file, you should get the following HTML output:
    
    
    This is some sample text<
    
    
    Now, you may say, "That isn't that great. Why would I need a class to do that?" Ok, ok. I agree too, but let me show you how this class will make money for you.
    Let's just say that you wanted to create a form from some data that was pulled from a database. Here's how you would create that form using this class:
    
    
    
Email:
Website:
Message:
What does this do? Weeelll...When the tag function is called, it checks the tag for the "as" attribute. This attribute tells it how to render the tag. However, you can also override it by using the override attribute of the tag function. Here's the syntax: tag([tag name],[value],[override tag name]); If the override attribute is not set, it'll use the default. So, that's it. There are more tricks that can be done with this class, but I'll save them for another article.


Other 3 submission(s) by this author

 

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this article(in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments

 There are no comments on this submission.
 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this article has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular article, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | PHP Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyrightę 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.