![]() |
|
#1
|
||||
|
||||
Template?I'm working on my site today and as it turns out I will be use the HTML for this page alot so I was wounding if it would be better to make the HTML a template and use PHP. So that instead of rewriting the HTML a hundred or more times use a template and then use PHP to load the content in. What does everyone think? and how hard would this be to complete?
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#2
|
||||
|
||||
|
If you've recently upgraded your PHP to version 4.3+, things got a little easier for you to 'cook up' a very simple template for yourself... using
file_get_contents( string filename [, int use_include_path] ) see details here. Once you 'read' this file into your script, all you do is use str_replace() or a similar custom function, to find markers in your template (iow the HTML files) and replace them with the relevant data? I personally haven't used this function anywhere in my PHP scripts... yet but from what I read so far about this new function, it's makes doing something like this a lot simpler. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#3
|
||||
|
||||
|
I checked maxipointservers my host and there still using PHP 4.0.6.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#4
|
||||
|
||||
|
I need a little advice on my site. I had though about using PHP Templates because I thought that it would cut down on the size of the site over all and make it faster but if I use Templates. I would have the create the HTML Template file and then a PHP file for each of the pages that would use that template. If this is correct then I don't really see this has being any small in size then if I were to just make a HTML page for each. Am I correct?
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#5
|
||||
|
||||
|
what would be the best way to input this type of info without have to edit the HTML everytime? Take a look at the page and let me know what you think.
Test Site Thanks __________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#6
|
||||
|
||||
|
Quote:
Actually this depends on just how comfortable you are with PHP. It can be as elaborate as that or as simple as using just 3 or 4 files to run an entire template-driven site. I really have to sit down and write you a simple tutorial this weekend!. __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#7
|
||||
|
||||
|
Don't go to any trouble to do it. I know how important time is so it’s not that important I can find tutorials on the net. I just don't what you to go to all that trouble just for me. Its just something I've been interested in so there no hurry. As you can see I'm jumping from topic to topic right now. Trying to learn more, mostly just studying and reading what ever I can get me hands on
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#8
|
||||
|
||||
|
Quote:
Whew! I was beginning to think I was the ONLY one who was noticing that! ![]() Nevertheless, I will write one for you...I just hope I can do it before you start getting out your Java notes... this week! __________________
J de Silva Learning Journal | GIDForums™ | GIDNetwork™ | GIDWebhosts™ | GIDSearch™ |
|
#9
|
||||
|
||||
|
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization. |
|
#10
|
||||
|
||||
|
The simplest form of templating, IMHO, is to use the PHP builtin include() function...the way I do this is to make a small group of "static" files like so:
top.php left.php bottom.php These pages contain all of the static and/or semi static information that goes into the topbar, bottom bar and sidebar of the site...then I simply make a file for each new page and include the 3 files named above in the appropriate place, this allows me to make site wide changes quickly and easily...mostly...using a regular template engine is probably a bit easier in this regard once you get the hang of it but if you are pressed for time this is an easy way to do it. Elmseeker |
Recent GIDBlog
2nd Week of IA Training by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Content Management HELP! | JamesRxx555 | Web Design Forum | 7 | 06-Jul-2003 22:48 |
| [Tutorial] XSL Basics Pt. II | pcxgamer | Web Design Forum | 0 | 21-Apr-2003 07:11 |
| patTemplate Templating Engine!? | Elmseeker | MySQL / PHP Forum | 5 | 12-Jan-2003 18:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The