Current location: Hot Scripts Forums » Programming Languages » PHP » How to <!--include .htm files in .php files


How to <!--include .htm files in .php files

Reply
  #1 (permalink)  
Old 10-26-03, 01:20 AM
cstallins's Avatar
cstallins cstallins is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
How to <!--include .htm files in .php files

My .shtml files use several serverside includes. However, I can't get the includes to work in my PHP files, and I cannot find anything on the topic via searching this site. Can you offer the quick fix, or point me to info on how to get my server-side includes to work properly in PHP files? Do I want to use the include() or require() function?

Thank you for any advice you can offer.
Curtis
__________________
CurtFun
PHP Novice Extraordinaire
...Kurtz got off the boat...
Reply With Quote
  #2 (permalink)  
Old 10-26-03, 01:23 AM
mdhall's Avatar
mdhall mdhall is offline
Aspiring Coder
 
Join Date: Oct 2003
Posts: 510
Thanks: 1
Thanked 1 Time in 1 Post
Try this...

<?php include("filename.ext"); ?>

where you want the file to show up on your page.
Reply With Quote
  #3 (permalink)  
Old 10-26-03, 01:51 AM
cstallins's Avatar
cstallins cstallins is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
mdh, my <!-- server-side include issue is solved.

mdh, your <?php include("filename.ext"); ?> worked like a charm. I figured it might be the include() function, but I'm just scratching the surface of this great and enabling language and haven't yet learned to use it (plus, I notice that it's still about 25 pages ahead of me in the book I'm working my way through).

Thank you very much for taking the time to get me going. I certainly do appreciate it.
Curtis
__________________
CurtFun
PHP Novice Extraordinaire
...Kurtz got off the boat...
Reply With Quote
  #4 (permalink)  
Old 10-27-03, 02:55 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
it would be better if you used include_once() or require_once() .."This is a behavior similar to the include() statement, with the only difference being that if the code from a file has already been included, it will not be included again. As the name suggests, it will be included just once" -quoted from php manual
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]
Reply With Quote
  #5 (permalink)  
Old 10-27-03, 05:35 AM
ermau's Avatar
ermau ermau is offline
Wannabe Coder
 
Join Date: Aug 2003
Location: Florida, USA
Posts: 240
Thanks: 0
Thanked 0 Times in 0 Posts
Nevermind is correct, to even add on top of that, for things not needing variables in them (and sometimes even if they do have variables) use single quotes:
include_once('filename.ext');
__________________
PHP / mySQL Developer
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 07:16 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.