Maybe you could use auto_prepend_file in php.ini:
http://php.net/manual/en/i
Main Topics
Browse All TopicsI have to update a site that has a few hundred html pages and uses frames. The admin wants to rid the site of the use of frames.
I have gotten as far as to replacing the index page by including dynamic URL for the navigation menu.
Here is my challenge, the HTML files that is called up from the menu ALSO includes links, if a user clicked on one of those links, it will replace the whole page.
Is there a way I can have the menu.php heading appear on 'every clicked link' without having to edit each html page to include the <? include("menu.php"); ?> tag?
Also, we don't have an apache server, we are using the rare Xitami server. We do have MySQL on our server
Please let me know if I need to clarify my problem.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Maybe you could use auto_prepend_file in php.ini:
http://php.net/manual/en/i
auto_prepend_file would have been a good option, except there are a few sites that we host that I don't want the header to appear on. Which is also the reason I am leery of doing a multi-file find/replace.
As far as using a main layout, would that affect the links that are pulled after a link from the navigation menu is displayed. It is the links that are not called within the navigation menu that I have a question about.
Problem is, say if the 'offices.html' page is called, it is the links on the offices.html page that I am having a problem with b/c it over takes the whole page.
If PHP is not an option, is there something else that can be used. CSS?
Upon some research, I find that a solution for me may be Ajax. Which I barely know anything about. I have a controller page in PHP (code below).
What is happening now is that when a link is clicked on the menu.php, the content of the <div> is loaded with the html page.
--->What I would like to happen is IF a link is clicked WITHIN the <div>, then only the content of the <div> will be reloaded. All links within div are coming from my domain only.. . I am not trying to load pages from other sites.
I have downloaded prototype.js and am thinking I need to use the event_observer in some way.
Any advice, hints, links to resources or examples will be extremely helpful.
P.S. I am new to this forum and realize I need to add 'zones' to this question, as it may not be PHP related, but not sure how.
>> I have downloaded prototype.js
Consider using jQuery instead, it is more powerfull.
http://jquery.com/
This is wrong:
<div="change_content">
Change it to:
<div id="change_content">
Then with jQuery, you can do something like below to change all links within the DIV:
I would really recommend against trying to use Javascript to emulate what you did with frames. If you really want to get rid of frames then change your pages completely. It will just cause more issues and make your site less friendly to visitors to try to do it any other way. Of course it depends why your admin wants to move away from frames but usually it is to make the site more user/browser friendly. The way you are headed it will be less so.
By the way ... since you are new to AJAX when I said Javascript that would include an AJAX solution (or any prototype of JS framework like JQuery, etc). Either stick with frames or be willing to redesign the site so you don't use the frame design.
Let me know if you have a question or need more info.
bol
By the way ... you can still benefit from the idea used in frames (e.g. a common section to a page) by using includes instead. PHP will support them. They make it so part of the PHP for a page comes from a common file (i.e. header, menu on one side, etc). It is the way to cut down on the code needed in a page and simplify future updates for the site. If you do the redesign you should probably make sure you consider these but how you use them will depend on your site design.
bol
Thank you cxr and b0lsc0tt for replying!
b0lsc0tt, the site has been using frames for about 7 years , and the admin wants a newer/updated design. We are using PHP5, MySQL, and Xitami for a webserver.
The company has about 10 departments. Some depts have their own URL, and when a user accesses that particular URL, we wouldn't want the main navigation menu present. That is why I can't add a PHP include to all the pages. We only want the navigation menu when accessing through the main company URL.
I don't mind frames or iframes, but if there were a way to use it so that it didn't 'look' like frames, it would be great. A CMS is not a great option as the admin is bent on staying with Xitami for a web server. Given all of this, a complete redesign is the 'best' route?
cxr: Thank you! I am going to work with the code and see how far I get.
This is the site that I am contracted to remove frames from:
http://www.catholic-doc.or
>> Some depts have their own URL, and when a user accesses that particular URL, we wouldn't want the main navigation menu present. <<
Make changing that part of the redesign. Of course maybe there is a reason for it but if "their own URL" means a different domain name then you will have real problems trying the alternate that was suggested, AJAX. Basically, browser security prevents Javascript from working across different domains, protocols or servers. In other words you could only get pages that were on your same domain.
Hiding the URL and keeping it the same is not as popular or accepted anymore. Not only does it make bookmarking hard or impossible (which maybe something wanted) but it can also affect search engine listing/ranking.
Instead the method to use is url rewriting. It depends on the server to support this but most have some way to do it (and Apache can do it by default). Using it you can rewrite the URL to keep it friendly for the site while loading a page that is on a different server or even domain on the same server. It is used to keep URLs clean for SEO but also to protect content or URLs. Some of the same benefits of frames now are done with the rewrite. If your server is IIS then there is an option for it but I believe it is 3rd party (depending on your IIS version I believe) and may have a little cost.
The benefit of the rewrite is it can be used to handle the links on a page. The server would know what to do with a link. If you aren't familiar with using these though and really need to keep the site structure the way it is now then you may want to get somebody that can help consult with doing the rewrites. Or do some research on it. :)
Let me know how that helps or if you have a question.
bol
Business Accounts
Answer for Membership
by: kebabsPosted on 2009-10-06 at 18:31:48ID: 25511508
Use a main layout file that includes the menu and the requested content page.
Or use an editor with multi-file find and replace to add the code to every HTML file