Now we get to dealing with blocks. Really, it's just more of the same... We define some variables with some stuff in them, and then we shuffle the variables around to get what we want. Let's take a file called 'two.ihtml'...
Now, we have two types of buckets we want to manipulate text in: a variable, and a block. First, we define the variable that contains the entire file...
and then we want to break out the block...
What did we just do here? We now have three PHPLIB template variables defined here: 1) 'AccessBlock', which contains the text '<LI> {item}' 2) 'ABlock', which is a place-holder for where AccessBlock USED to be, and is now a variable, dealt with like any other variable! 3) 'input_two', which contained the original text of file two.ihtml MINUS the block we've just removed, which has been replaced with the variable tag 'ABlock'. When 'AccessBlock' was removed from 'input_two', the text of '<LI> {item}' was taken out of the 'input_two' variable and replaced with the 'ABlock' variable. Now, let's assume that we have an array of stuff we want for Christmas:
We can make that Christmas list very easily here...
Pretty slick, eh? So long as you keep the template block definitions and variable names the same within the source (.ihtml) file, you can use table rows, ordered/unordered lists, BR tags, whatever suits your fancy.
blog comments powered by Disqus |