GPSJane Posted December 23, 2009 Share Posted December 23, 2009 I have only just begun with php so I am not looking to do anything complicated but I do need to use SSI to make updating easier.BUT, when I put the include in the page doesn't display correctly at all even though I designed the page first meticulously before transferring part of it to a text file.Here is the include code I am using and then the html. <?php include("includes/nav_bar.txt"); ?> <DIV id="logo"> <IMG class="nav" src="images/flower.png"><!--<IMG class="nav" src="images/title.png"> --> </DIV> <DIV id="nav_bar_top"> </DIV> <DIV id="nav_bar_middle"> <UL class="nav_list"> <LI class="nav_item"><A class="nav" href=""><DIV id="middle">Home</DIV></A></LI> <LI class="nav_item"><A class="nav" href=""><DIV id="middle">Invitation</DIV></A></LI> <LI class="nav_item"><A class="nav" href=""><DIV id="middle">Information</DIV></A></LI> <LI class="nav_item"><A class="nav" href=""><DIV id="middle">Map & Directions</DIV></A></LI> <LI class="nav_item"><A class="nav" href=""><DIV id="middle">Accomodation</DIV></A></LI> <LI class="nav_item"><A class="nav" href=""><DIV id="middle">Registry</DIV></A></LI> <LI class="nav_item"><A class="nav" href=""><DIV id="middle">Invitation</DIV></A></LI> </UL> </DIV> <DIV id="nav_bar_bottom"> </DIV> It looks like the DIV and IMG tags are all missing but I can't understand why? Link to comment Share on other sites More sharing options...
GPSJane Posted December 23, 2009 Author Share Posted December 23, 2009 Er, I seem to figure things out as I write them down here! Even after spending ages on them before.Does the file type of the part to be included matter? It seems to as I changed the include to .html and now all is good :)DO I always use html or do I ever use txt or something else? Link to comment Share on other sites More sharing options...
justsomeguy Posted December 23, 2009 Share Posted December 23, 2009 Make sure your server is running PHP and that the file you have the include statements in is a .php file. By default the server won't execute PHP code inside a .html file, only .php. Your include files don't need to be .php files, but the file that has the include statement does need to be. Link to comment Share on other sites More sharing options...
GPSJane Posted December 23, 2009 Author Share Posted December 23, 2009 Oh ja I wasn't clear. My file with the include statement is a php file and php is running just fine. But the stuff to be included was a txt file which didn't work but now as an html it's fine.Eg: index.php had an include pointing to menu.txt. I had to change it to menu.html for it to work. Make sure your server is running PHP and that the file you have the include statements in is a .php file. By default the server won't execute PHP code inside a .html file, only .php. Your include files don't need to be .php files, but the file that has the include statement does need to be. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 24, 2009 Share Posted December 24, 2009 That's interesting, I haven't had that problem. I used to use .inc to specify my include files and everything worked fine. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.