GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 25-Mar-2003, 14:37
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough

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  
Old 26-Mar-2003, 05:09
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
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.
  #3  
Old 26-Mar-2003, 07:23
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
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  
Old 26-Mar-2003, 07:36
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
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  
Old 14-Apr-2003, 09:44
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
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  
Old 15-Apr-2003, 06:59
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Quote:
Originally posted by pcxgamer
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?


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!.
  #7  
Old 15-Apr-2003, 07:49
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
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 . Thank you for our offer if your planning on writing one for your site I can wait until you do that.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #8  
Old 15-Apr-2003, 08:03
JdS's Avatar
JdS JdS is offline
Senior Member
 
Join Date: Aug 2001
Location: KUL, Malaysia
Posts: 3,371
JdS will become famous soon enough
Quote:
Originally posted by pcxgamer
As you can see I'm jumping from topic to topic right now.


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!
  #9  
Old 15-Apr-2003, 08:09
pcxgamer's Avatar
pcxgamer pcxgamer is offline
Senior Member
 
Join Date: Sep 2002
Location: South Carolina, USA
Posts: 1,095
pcxgamer is a jewel in the roughpcxgamer is a jewel in the roughpcxgamer is a jewel in the rough
your not the only to notice. But I'll be sticking around learning programming but I've been helping some friends with HTML and CSS and I'm just in the mode to learn new things. But we all know me.
__________________
If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization.
  #10  
Old 15-Apr-2003, 11:03
Elmseeker's Avatar
Elmseeker Elmseeker is offline
Junior Member
 
Join Date: Jan 2003
Posts: 87
Elmseeker is on a distinguished road
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 GIDBlogProblems with the Navy (Chiefs) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Content Management HELP! JamesRxx555 Web Design Forum 7 06-Jul-2003 23:48
[Tutorial] XSL Basics Pt. II pcxgamer Web Design Forum 0 21-Apr-2003 08:11
patTemplate Templating Engine!? Elmseeker MySQL / PHP Forum 5 12-Jan-2003 19:56

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 22:57.


vBulletin, Copyright © 2000 - 2009, Jelsoft Enterprises Ltd.