Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ![]() Interested in joining? Click here. If you are already a member of ZBCode, feel free to login right here: |
| Javascript / PHP / Including something | |
|---|---|
| Tweet Topic Started: Apr 25 2009, 04:23 PM (221 Views) | |
| .Deluxe | Apr 25 2009, 04:23 PM Post #1 |
![]()
|
Well, basically, I have my HTML template in the file index.html. Externally, I want to a file to hold this HTML drop-down menu which links to other websites in the network; as this drop down will go on each page and is likely to change often, so I don't want to have to go through every single page to edit drop down menu items, as my site has hundreds, if not thousands of pages! Here's my HTML, can someone make it "include friendly" and please give me the line of code on how I would include it? I've tried PHP includes and javascript but to no avail so thought I might be doing something wrong?
Cheers!
|
![]() |
|
| rockon1824 | Apr 25 2009, 05:48 PM Post #2 |
|
I never know what to put for my member title. =(
![]()
|
Save that HTML as is in its own file. Then, in the file you want to include it in, put this where you want it to appear:Replace "example.html" with whatever you named the other file. Two important notes: both files must be in the same directory, and the main file (where you put the above code) must be saved as a PHP file. Edited by rockon1824, Apr 25 2009, 05:49 PM.
|
| |
![]() |
|
| Reid | Apr 26 2009, 09:53 AM Post #3 |
![]()
What? The land of the free? Whoever told you that was your enemy.
![]()
|
Indeed. If they aren't in the same directory, you could of course just reference the file otherwise, couldn't you? |
| The Resource Board | |
![]() |
|
| .Deluxe | Apr 27 2009, 05:17 PM Post #4 |
![]()
|
You see, thats what I tried, but when I ran the file uploaded and locally it didn't work :S |
![]() |
|
| Kevin | Apr 27 2009, 05:44 PM Post #5 |
![]()
|
Do you have PHP installed locally? Also, were any error messages given, or did it just show nothing? |
| |
![]() |
|
| Reid | Apr 27 2009, 05:49 PM Post #6 |
![]()
What? The land of the free? Whoever told you that was your enemy.
![]()
|
You could try it on http://www.ripway.com/ - they offer free PHP hosting (with a 30mb daily bandwidth limit I believe) |
| The Resource Board | |
![]() |
|
| .Deluxe | Apr 28 2009, 09:28 AM Post #7 |
![]()
|
I found the problem, it was because the pages where I was using the PHP include were saved as a *.html format. I rectified by changing all the page extension names to *.php and it worked wonders.
|
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Code University · Next Topic » |

















7:48 PM Jul 10