|
Post Number: 1
|
ShakerMaker
Mad For It
Group: Members
Posts: 103
Joined: Sep. 2001
|
|
Posted on: May 27 2002,09:16 |
|
|
Is there anyway of using say PHP to make a template file and use a line of code that inserts text into the html from a simple text file? If that makes any sense...
Edited by ShakerMaker on Jan. 01 1970,01:00
|
|
|
|
Post Number: 2
|
Beldurin
Mayor of Detnet
Group: Members
Posts: 1242
Joined: Aug. 2001
|
|
Posted on: May 27 2002,19:41 |
|
|
Quote (ShakerMaker @ 27 May 2002,03:16) | Is there anyway of using say PHP to make a template file and use a line of code that inserts text into the html from a simple text file? If that makes any sense... |
write the template in html, name it .php and then where you want to insert the text use the following command
Code Sample | <? include("$DOCUMENT_ROOT/path/filename"); ?>
|
Easy as pie.
edit: made the code stand out
Edited by Beldurin on Jan. 01 1970,01:00
-------------- If someone's ungrateful and you tell him he's ungrateful, okay, you've called him a name.
You haven't solved anything.
-- zen and the art of motorcycle maintenance
|
|
|
|
Post Number: 3
|
ShakerMaker
Mad For It
Group: Members
Posts: 103
Joined: Sep. 2001
|
|
Posted on: May 28 2002,07:06 |
|
|
Quote (Beldurin @ 27 May 2002,11:41) | Quote (ShakerMaker @ 27 May 2002,03:16) | Is there anyway of using say PHP to make a template file and use a line of code that inserts text into the html from a simple text file? If that makes any sense... |
write the template in html, name it .php and then where you want to insert the text use the following command
<? include("$DOCUMENT_ROOT/path/filename"); ?>
Easy as pie. |
Holy shit! To easy! Thanks heaps!
Shouldn't that read:
<?php include("$DOCUMENT_ROOT/path/filename"); ?>
?
Thanks a million!
|
|
|
|
Post Number: 4
|
ShakerMaker
Mad For It
Group: Members
Posts: 103
Joined: Sep. 2001
|
|
Posted on: May 28 2002,07:27 |
|
|
Woohoo! It worked!
It works with html as well.
Is there a way to do this with only using one template? So that every html file is opened in that ONE template?
Like on some sites I see the link that ends with: file.php?=100
How do I do that?
Edited by ShakerMaker on Jan. 01 1970,01:00
|
|
|
|
Post Number: 5
|
Beldurin
Mayor of Detnet
Group: Members
Posts: 1242
Joined: Aug. 2001
|
|
Posted on: May 29 2002,18:36 |
|
|
1.) you don't need the "php" in the <? tags...it works fine w/out it
2.) I actually do it backwards from what you're asking. What I do is I put all "common" design and layout elements before the page content into a header file, and all the layout stuff after the page content into a footer file. Then, each individual display file looks like this.
Code Sample | <? include("/SSIdirectory/header.php"); ?>
page content, page content, page content, page content, page content, page content, page content, page content, page content, page content, page content, page content,
<? include("/SSIdirectory/footer.php"); ?>
|
bam! now any layout/logo/color/design changes are only made in 1 file, and are reflected througout the site. The file.php=100 is simply passing an arguement to the script, you can do all sorts of stuff w/that. If you want some examples of PHP and these kinds of things, email me at beldurin@packethell.com. Hope that helps!
-------------- If someone's ungrateful and you tell him he's ungrateful, okay, you've called him a name.
You haven't solved anything.
-- zen and the art of motorcycle maintenance
|
|
|
|
Post Number: 6
|
Wiley
©0®ÞØ®4+3 whØ®3
Group: Members
Posts: 1268
Joined: Oct. 2001
|
|
Posted on: May 29 2002,20:43 |
|
|
Beldurin, You have now exceeded the maximum number of helpful answers that you are allowed to give in the geek forum. The only thing you are allowed to say for the durration of this thread is ...h4h4, j00 h4v3 n0 l33t pHp 5k1llz l1k3 m3, h4h4h4 l4m0r!!
-------------- There's a sucker born every minute ...but swallowers are hard to find.
|
|
|
|
Post Number: 7
|
Beldurin
Mayor of Detnet
Group: Members
Posts: 1242
Joined: Aug. 2001
|
|
Posted on: May 29 2002,21:24 |
|
|
Quote (Wiley @ 29 May 2002,14:43) | Beldurin, You have now exceeded the maximum number of helpful answers that you are allowed to give in the geek forum. |
rofl...I almost fell out of my chair!
Quote | The only thing you are allowed to say for the durration of this thread is ...h4h4, j00 h4v3 n0 l33t pHp 5k1llz l1k3 m3, h4h4h4 l4m0r!! |
um...what he said.
-------------- If someone's ungrateful and you tell him he's ungrateful, okay, you've called him a name.
You haven't solved anything.
-- zen and the art of motorcycle maintenance
|
|
|
|
Post Number: 8
|
ShakerMaker
Mad For It
Group: Members
Posts: 103
Joined: Sep. 2001
|
|
Posted on: May 30 2002,06:36 |
|
|
Thanks again Beldurin.
|
|
|
|
|
|