My biggest problem is trying to figure out the holy grail, how to produce template files which are complete HTML files, with markers / tags for where I need to add my data. I can do the basic replace of strings. Heres an example of what I have now.
$middleheader = template("tpl/header.htm");
$middleheader = str_replace("SUBDIR", "", $middleheader);
$middleheader = str_replace("[1NEWS]", "", $middleheader);
$middleheader = str_replace("[2NEWS]", "", $middleheader);
$middleheader = str_replace("TEXTADS", $TEXTADS, $middleheader);
echo $middleheader;
So here I'm reading in my header file and replacing elements with values, in most cases here, blanks.
However, this is the first use of a template in my file, I'm not doing anything with meta tags, I'm tempted to just leave them hard coded in my php file, but this would make it more difficult, if say in the future I wanted someone with only HTML knowledge to design me a new style for my site.
A) What should I do with my meta tags? what should I put in my template file? Should I keep them all in some sort of settings file?
The most common problem with my hard coded files, is loops, where I have html (perhaps the start of a table), data, more html etc, back to start of the loop.
B) How would I create tags in the template file to handle loops?
Also, I have a lot of similar pages with small differences.
C) Where do I draw the line and create another HTML template file?
Hope someone can give me some insight.
by JM
No comments:
Post a Comment