Jump to content

Help please, thank you!


Recommended Posts

I have a site and i want to make my menu header like this "Home Forums Avatar Bleach Naruto One Piece Legal Disclaimer Contact Us". But if i want to change it to something else and for example remove one thing, how can i edit a file to make the changes in all files. It has to do something with php, but i forgot how to do it.So basically if i had a box saying "Hello" and its on 10 pages, i want to edit 1 file to change it saying "Hello and welcome" on all 10 pages instead of chaning it one by one... Understand?Thank you for helping me!

Link to post
Share on other sites

Put the menu in a separate file. NOT a complete HTML document, but just the code for the menu. Then, in the other documents, where you want the menu to appear, add a line like this: <?php include ("menu.html"); ?> Make sure those other docs have a .php extension.If it's style changes you want to make, then just use an external style sheet and link to it, as you probably already do or have done.

Link to post
Share on other sites
Put the menu in a separate file. NOT a complete HTML document, but just the code for the menu. Then, in the other documents, where you want the menu to appear, add a line like this: <?php include ("menu.html"); ?> Make sure those other docs have a .php extension.If it's style changes you want to make, then just use an external style sheet and link to it, as you probably already do or have done.
I tried that, it doesnt work...here is what i am doing and here is the source files (Download it please --> http://leechbox.com/filesforsite.rar )OFFTOPIC: how do you like my banner?

post-23182-1215793603_thumb.jpg

Link to post
Share on other sites

Sorry. Your .rar file doesn't expand for me, maybe because I'm on a Mac. Could you just copy/paste the relevant snippets of code that don't work? I actually tested the include trick I showed you, so it really should be okay.

Link to post
Share on other sites
Sorry. Your .rar file doesn't expand for me, maybe because I'm on a Mac. Could you just copy/paste the relevant snippets of code that don't work? I actually tested the include trick I showed you, so it really should be okay.
menu.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body>HELLO</body></html>
page.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body><?php include ("menu.html"); ?></body></html>
Link to post
Share on other sites

Right. As I said, menu.html should NOT be a complete html document. Include() is literally going to embed everything that's in the file, so the doctype and html tags that create the "wrapper" for the content just duplicate what's already in page.php. Going off the way you have it set up here, all menu.html should contain is the word HELLO. (Note: I only suggested using the html extension for convenience. It could really be anything that implies non-executable text.)

Link to post
Share on other sites

In post #5 above, you provide two files: menu.html and page.php. To make that test work, leave page.php as it is. But change menu.html to look like this:

HELLO

I'm really serious. That's all it needs, and then you'll see how the text gets included.Then, to include the real menu, all you need in that file is the markup for the actual menu, not a complete html document.

Link to post
Share on other sites
I dont understand what your talking about.. can you do it for me please?
I tried thispage.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title></head><body><?php include ("menu.html"); ?></body></html>

menu.html

hello

Umm... So it still doesnt work... WHY :) im a big noob at this... please help!

Link to post
Share on other sites

I tested your files and everything works.I may have made a bad assumption. When you opened this thread by mentioning php, I assumed you had php installed. Do you? One way to tell would be to run page.php again, and then, still in your browser, view the source code. If the php tag is visible there, then php is not turned on. You'll have to turn it on in your server's control panel. (Assuming it's available.)I've also been assuming that you're testing this from your server. If you try to view these files on your desktop, the php code will not be interpreted.

Link to post
Share on other sites
I tested your files and everything works.I may have made a bad assumption. When you opened this thread by mentioning php, I assumed you had php installed. Do you? One way to tell would be to run page.php again, and then, still in your browser, view the source code. If the php tag is visible there, then php is not turned on. You'll have to turn it on in your server's control panel. (Assuming it's available.)I've also been assuming that you're testing this from your server. If you try to view these files on your desktop, the php code will not be interpreted.
Oh ok, ill check that out.. If it doesnt work then ill reply but ill assume it will work! TY!EDIT: it worked .. TY !!!
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...