The Sea King Posted December 8, 2007 Share Posted December 8, 2007 I need to find myself a way to keep a menu updated through just one file. Is even that possible? Link to comment Share on other sites More sharing options...
jlhaslip Posted December 8, 2007 Share Posted December 8, 2007 php includes or ASP includesCheck out the Tutorials at the main site http://w3schools Link to comment Share on other sites More sharing options...
Guest FirefoxRocks Posted December 9, 2007 Share Posted December 9, 2007 I highly recommend using PHP or ASP includes as suggested above but you can do it with iframes too (but I do not recommend that since <object> doesn't work properly in IE and <iframe> is deprecated). Link to comment Share on other sites More sharing options...
The Sea King Posted December 9, 2007 Author Share Posted December 9, 2007 Two questions. 1:Do we have to put the exact url of the file?2:How do we do Iframe? Link to comment Share on other sites More sharing options...
Synook Posted December 9, 2007 Share Posted December 9, 2007 1:Do we have to put the exact url of the file?Relative URLs are fine.2:How do we do Iframe? <iframe src="menufile.html" style="height:500px; width:200px; "></iframe> But a server-side solution is far better. Link to comment Share on other sites More sharing options...
Anders Moen Posted December 10, 2007 Share Posted December 10, 2007 If you're able to use a server-side language like PHP, that would be much much much betterIf you have you're menu in an iframe...well, that just sucksIt's not even 100 % sure that spiders/bots will be able to click on your links in the menu if you have it in an iframe Link to comment Share on other sites More sharing options...
The Sea King Posted December 11, 2007 Author Share Posted December 11, 2007 Iframe didn't show the menu properly... and PHP foesn't want to show it at all... Link to comment Share on other sites More sharing options...
Ingolme Posted December 11, 2007 Share Posted December 11, 2007 Forget the <iframe>, I don't recommend it at all.Try this:<?phpinclude("file.html");?>And inside file.html you could have a menu, for example like this:(You don't need <html> <head> or <body> tags, just the menu code) <ul id="menu"> <li><a href="URL">Link</a></li> <li><a href="URL">Link</a></li> <li><a href="URL">Link</a></li> <li><a href="URL">Link</a></li></ul> Link to comment Share on other sites More sharing options...
The Sea King Posted December 11, 2007 Author Share Posted December 11, 2007 I tried that also...i'll do some test pages. Link to comment Share on other sites More sharing options...
Ingolme Posted December 11, 2007 Share Posted December 11, 2007 But that can't fail unless your server doesn't have PHP or the file isn't found. Link to comment Share on other sites More sharing options...
The Sea King Posted December 11, 2007 Author Share Posted December 11, 2007 yeah...I know...Anyways here are the test pages:http://xentrance.freehostingnow.com/test.htmlhttp://xentrance.freehostingnow.com/test2.html Link to comment Share on other sites More sharing options...
Ingolme Posted December 11, 2007 Share Posted December 11, 2007 You're supposed to save the file with a .php extension so that it runs the PHP. Link to comment Share on other sites More sharing options...
The Sea King Posted December 12, 2007 Author Share Posted December 12, 2007 It works. Thanks.http://xentrance.freehostingnow.com/test.php Link to comment Share on other sites More sharing options...
The Sea King Posted December 12, 2007 Author Share Posted December 12, 2007 I just tested something (putting it in a different folder and it doesn't work)... http://xentrance.freehostingnow.com/lw/test.phphttp://xentrance.freehostingnow.com/lw/tet.php Link to comment Share on other sites More sharing options...
justsomeguy Posted December 12, 2007 Share Posted December 12, 2007 It looks fine to me, I can't tell that it's not working. What should it look like? What does the PHP code look like? Link to comment Share on other sites More sharing options...
Ingolme Posted December 12, 2007 Share Posted December 12, 2007 The menu and the file have to be in the same folder, if they're not, you'll have to modify the include command to where the file is located. Link to comment Share on other sites More sharing options...
The Sea King Posted December 12, 2007 Author Share Posted December 12, 2007 The menu and the file have to be in the same folder, if they're not, you'll have to modify the include command to where the file is located.How do I do that?I did it to http://xentrance.freehostingnow.com/lw/tet.php ...Edit:Weird my host removes the PHP code...with the folder.... Link to comment Share on other sites More sharing options...
Ingolme Posted December 12, 2007 Share Posted December 12, 2007 For example if test.php is in one folder and menu is in another, such as this diagram: root directory | ----------------- | | folder file.html | test.php Then in test.php you'd write:<?php include("../file.html"); ?> Link to comment Share on other sites More sharing options...
Ingolme Posted December 12, 2007 Share Posted December 12, 2007 EditSorry, my internet was going slow and sent the message twice. Link to comment Share on other sites More sharing options...
The Sea King Posted December 12, 2007 Author Share Posted December 12, 2007 The exact url is this:http://xentrance.freehostingnow.com/test2.htmlSo...I have to write it like this?<?phpinclude("/test2.html")?> Link to comment Share on other sites More sharing options...
Ingolme Posted December 12, 2007 Share Posted December 12, 2007 No, forget the (/). In most servers that will go pretty much further up than the top level of your site.Try:<?phpinclude("../test2.html")?> Link to comment Share on other sites More sharing options...
The Sea King Posted December 12, 2007 Author Share Posted December 12, 2007 No, forget the (/). In most servers that will go pretty much further up than the top level of your site.Try:<?phpinclude("../test2.html")?>Thanks yet again! Anyways is that rule with the dots on W3 schools? Link to comment Share on other sites More sharing options...
Ingolme Posted December 12, 2007 Share Posted December 12, 2007 I haven't seen it there, it's just something I've known for years, because I used to use it to navigate through folders in a very old computer of mine.../ means parent directory while ./ means current directory (which is the same as not putting anything at all). Link to comment Share on other sites More sharing options...
The Sea King Posted December 12, 2007 Author Share Posted December 12, 2007 Thanks. Now my thanks!http://ingolme.youaremighty.com/ Link to comment Share on other sites More sharing options...
The Sea King Posted December 14, 2007 Author Share Posted December 14, 2007 Question: What if I wanted to go to the very first menu, do I type it with three dots? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.