PHP Classes

File: functions.txt

Recommend this page to a friend!
  Classes of Niels Scheffers   Templato   functions.txt   Download  
File: functions.txt
Role: Documentation
Content type: text/plain
Description: Function reference
Class: Templato
Template class with looping capabilities
Author: By
Last change:
Date: 21 years ago
Size: 3,173 bytes
 

Contents

Class file image Download
//Function reference: Detailed description of all functions in this class. //function Template($filename); Use: The constructor function for this class (automatically called on creation). Params: $filename => The filename of the template you want to use. Details: Checks wether the requested file actually exists, loads it into a variable and returns TRUE/FALSE on succesful/unsuccesful com- pletion. //function getLoop($repeat_string); Use: Marks a certain pair of (identical) template-tags as a 'loop'. Params: $repeat_string => The tag to look for. Details: Finds the first occurence of the specified tag, splits up the template on that point, and places the first part in the 'header'- container. It then looks for the second occurence of the tag, splits the remaining part at that point and places the first part in the 'loop'-container, and the last part in the 'footer'-container. If this function is called again it will place the output for the footer part of the loop in the 'template'-container, and will consider the header and loop part finished. //function setLoopVar($name, $replacewith); Use: Sets a value to be inserted for a certain tag. Params: $name => The tag to look for. $replacewith => Value to put there instead of the tag. Details: Just a simple class-variable shell. //function resetLoopVar(); Use: Clears all the values previously set for tags. Params: None. Details: Clears the array containing all values previously set. //function insertHeader(); Use: Parses the 'header'-container and moves the results to the 'output'- buffer. Params: None. Details: Walks through the 'loopvar'-array and replaces any tag in there with it's associated value. It then moves the results to the 'output'-buffer, appending to what was already there. //function insertFooter(); Use: Parses the 'footer'-container and moves the results to the 'output'- buffer. Params: None. Details: Walks through the 'loopvar'-array and replaces any tag in there with it's associated value. It then moves the results to the 'output'-buffer, appending to what was already there. //function insertLoop(); Use: Parses the 'loop'-container and moves the results to the 'output'- buffer. Params: None. Details: Walks through the 'loopvar'-array and replaces any tag in there with it's associated value. It then moves the results to the 'output'-buffer, appending to what was already there. //function outputRaw(); Use: Parses the 'template'-container and moves the results to the 'output'- buffer. Params: None. Details: Walks through the 'loopvar'-array and replaces any tag in there with it's associated value. It then moves the results to the 'output'-buffer, appending to what was already there. Use this function if there are no loops in your template. //function stripTag($tag); Use: Removes a tag from the template. Params: $tag => Tag to be removed. Details: Basically sets an entry into the 'loopvar'-containter for this tag, without a value. It's identical to calling setLoopVar($tag, "");.