rsrwebs Posted October 28, 2009 Report Share Posted October 28, 2009 (edited) Home Who We Are Hawk Mystery Training & Educational Programs A Rehabilitator's World Needs List Edited October 29, 2009 by rsrwebs Quote Link to comment Share on other sites More sharing options...
falkencreative Posted October 28, 2009 Report Share Posted October 28, 2009 I saved the header contents as a PHP file, and I put the include code into my index.htm page with the correct path name. In order to use PHP includes, your main page needs to use the .php extension. In this case, you'll need to change index.htm to index.php. Quote Link to comment Share on other sites More sharing options...
rsrwebs Posted October 28, 2009 Author Report Share Posted October 28, 2009 I saved the header contents as a PHP file, and I put the include code into my index.htm page with the correct path name. In order to use PHP includes, your main page needs to use the .php extension. In this case, you'll need to change index.htm to index.php. Okay, so in order for this set-up to function, everything has to be the PHP extension? Quote Link to comment Share on other sites More sharing options...
rsrwebs Posted October 28, 2009 Author Report Share Posted October 28, 2009 I just tested it again, saving index.htm to .php. Still nothing. Perhaps I should say f-it and just use an iframe? I understand those at least! Quote Link to comment Share on other sites More sharing options...
falkencreative Posted October 28, 2009 Report Share Posted October 28, 2009 Are you running this on a server (either on a server on your local machine or uploaded to your web hosting)? If you have uploaded it to your web host, are you sure your host supports PHP? If you have posted it to your hosting, post a link or send me a private message with the link? Quote Link to comment Share on other sites More sharing options...
falkencreative Posted October 28, 2009 Report Share Posted October 28, 2009 I looked over your code a bit, and I have to admit I'm a bit confused... Maybe it's that you haven't posted the entire files, but they seem to be set up wrong. For example, with those two files you have two sets of body tags... it just isn't what I would expect. For example, here is a brief example showing a php include used to include navigation elements: Index.php file: title nav.php: > </pre> <ul id="nav"> nav item nav item nav item nav item </ul> Quote Link to comment Share on other sites More sharing options...
abajan Posted October 29, 2009 Report Share Posted October 29, 2009 <?php include("nav.php"); ?> Quote Link to comment Share on other sites More sharing options...
Wickham Posted October 29, 2009 Report Share Posted October 29, 2009 (edited) You can put PHP includes inside other php includes; but your code doesn't have the include function; perhaps it should be like this:- PHP INCLUDES and footer.inc file has only this:- print $secret_password; ?> then the first page will show the word fish inside the p tags after two php codes. (I haven't followed all the previous posts so I'm just showing how it could work). Edited October 29, 2009 by Wickham Quote Link to comment Share on other sites More sharing options...
falkencreative Posted October 29, 2009 Report Share Posted October 29, 2009 (A page can only contain one set of body tags, and html tags for that matter, isn?t that right?). Correct. I noticed that in order for the declared variable contained in footer.inc.php to work, it must be wrapped in PHP tags. But that doesn't make any sense to me because if I were to put that section straight into my_page.php without using the include function, it would generate an error (as expected) because there would be PHP tags wrapped in PHP tags If you are using PHP, anything that you expect the server to understand/render as PHP HAS to be within PHP tags. If you have two separate files, with two separate blocks of PHP, they'll each need their own sets of PHP tags in order for the server to properly understand it. I understand that you are including a file, so you might expect that the first set of PHP tags could work for both files, but the server can't assume that the included file necessarily contains PHP code -- it could contain javascript, regular html, or anything. Quote Link to comment Share on other sites More sharing options...
rsrwebs Posted October 29, 2009 Author Report Share Posted October 29, 2009 Are you running this on a server (either on a server on your local machine or uploaded to your web hosting)? If you have uploaded it to your web host, are you sure your host supports PHP? If you have posted it to your hosting, post a link or send me a private message with the link? I know for a fact that my server is running PHP 5.0. I'm unsure why it won't load. Quote Link to comment Share on other sites More sharing options...
rsrwebs Posted October 29, 2009 Author Report Share Posted October 29, 2009 <?php include("nav.php"); ?> Quote Link to comment Share on other sites More sharing options...
abajan Posted October 30, 2009 Report Share Posted October 30, 2009 ...This stuff is beginning to make less and less sense to me...If by "stuff" you're referring to PHP in general, take heart, rswebs. Have you viewed the beginner PHP videos by Stef Mischook (frog)? They're the most easy to understand tutorials on PHP I've ever come across. I have tried learning PHP before and quit because it just seemed too overwhelming at the time but after watching Stef's videos, I have resolved to learn as much as I can about it. Quote Link to comment Share on other sites More sharing options...
falkencreative Posted October 30, 2009 Report Share Posted October 30, 2009 @rsrwebs: Stefan does have two video tutorials on PHP includes that might be worth a look. They should help clear up most of your confusion. http://killerphp.com/videos/02_php_includes/02_php_includes.html http://killerphp.com/videos/02_php_includes_part_2/02_php_includes_part_2.html Quote Link to comment Share on other sites More sharing options...
rsrwebs Posted October 30, 2009 Author Report Share Posted October 30, 2009 ...This stuff is beginning to make less and less sense to me...If by "stuff" you're referring to PHP in general' date=' take heart, rswebs. Have you viewed the beginner PHP videos by [b']Stef Mischook (frog)[/b]? They're the most easy to understand tutorials on PHP I've ever come across. I have tried learning PHP before and quit because it just seemed too overwhelming at the time but after watching Stef's videos, I have resolved to learn as much as I can about it. Hey, thank you! Where can I find these tutorials? Quote Link to comment Share on other sites More sharing options...
rsrwebs Posted October 30, 2009 Author Report Share Posted October 30, 2009 @rsrwebs:Stefan does have two video tutorials on PHP includes that might be worth a look. They should help clear up most of your confusion. http://killerphp.com/videos/02_php_includes/02_php_includes.html http://killerphp.com/videos/02_php_includes_part_2/02_php_includes_part_2.html I really appreciate the help, thanks. Quote Link to comment Share on other sites More sharing options...
abajan Posted October 30, 2009 Report Share Posted October 30, 2009 (edited) ...This stuff is beginning to make less and less sense to me...If by "stuff" you're referring to PHP in general' date=' take heart, rswebs. Have you viewed the beginner PHP videos by [b']Stef Mischook (frog)[/b]? They're the most easy to understand tutorials on PHP I've ever come across. I have tried learning PHP before and quit because it just seemed too overwhelming at the time but after watching Stef's videos, I have resolved to learn as much as I can about it. Hey, thank you! Where can I find these tutorials? Here's the entire list of the tutorials. You'll notice that not all of them can be linked to from that page. Most of others can be found at Idea22.com with slightly different titles in some instances but they are the same videos. I'll post the direct links when I get a chance. (EDITED to correct original link to the beginners PHP tutorial.) Edited November 21, 2009 by abajan Quote Link to comment Share on other sites More sharing options...
delirium Posted November 21, 2009 Report Share Posted November 21, 2009 <? include("nav.php"); ?> Quote Link to comment Share on other sites More sharing options...
jlhaslip Posted November 21, 2009 Report Share Posted November 21, 2009 (edited) <?php is the suggested method. Not all servers allow short_tags. . since it conflicts with the XML tag. Another thing, to add to what falkencreative posted above, an "included" file is always assumed to contain html and is parsed as such unless you add the php tokens. (<?php ... code here ... ?>) Edited November 21, 2009 by jlhaslip Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.