0

I 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 replace the frames w/php by including dynamic URL for the navigation menu.

Here is my challenge, the HTML file that is called up from the menu link includes links also, 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.

Please let me know if I need to clarify my problem.

4
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by diafol
0

Yes definetaly will need to clarify it further because -

Here is my challenge, the HTML file that is called up from the menu link includes links also, if a user clicked on one of those links, it will replace the whole page.

It seems that, by this your link opens up in the same page and you want to open it up in the new window, if that's it the target="_blank" will solve the purpose. or I doubt you mean something else?

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?

By that, it seems that you want some title or alt tag to appear on the hover of it.

0

Yes definetaly will need to clarify it further because -

It seems that, by this your link opens up in the same page and you want to open it up in the new window, if that's it the target="_blank" will solve the purpose. or I doubt you mean something else?

By that, it seems that you want some title or alt tag to appear on the hover of it.

I am sorry for my ambiguity. I have a PHP page that has 3 includes statements. Here is my summarized code for the 'controller' page.

<?
include_once "header.php";
?>
<div="change_content">
<? include_once "site_map.html"; ?>
</div>
<?include_once "footer.php";
?>

I was wanting to know if it is possible in PHP to do the following:

Once the site_map.html is loaded into the <div> container, is it possible that if a user was to click a link from within the <div> to ONLY reload the <div> content.

While I was searching for an answer, it seems my only hope is Ajax.? Or is such a thing still possible with some PHP code?

Any advice and tips will be extremely helpful!!!!

Thank you!

0

Yes, this is called Ajax. Depending on the complexity of the page, you could even get away with using just javascript to hide and show certain elements within your DIV. However, Ajax would probably be the way to go. If this is new to you, a library like Prototype from prototypejs.org would take the hard work out of creating ajax objects.

0

BTW: ajax only really works on the same domain, so if you have frames linking to external sites, this won't work. I suppose a work around for this would be to use iframes or cURL, neither of which are particularly nice.

If you don't want to go the whole way and ajaxify your code, as mentioned earlier, you could use a simple hide/show within js. The following is a v. simple example. Professional coders will laugh at my naivety, but it works. This method will become very cumbersome if your page is complex, but the basics are there - use js and style (or CSS file) to show/hide.

<style>
.hidden{
   display:none;
}
</style>
<script>
  function display(div){
   if(div == 'firstbit'){
     document.getElementById('firstbit').className='show';
     document.getElementById('secondbit').className='hidden';
   }else{
     document.getElementById('firstbit').className='hidden';
     document.getElementById('secondbit').className='show';
   }
  }
</script>


<a href="#" onclick="display('firstbit');return false;">show first</a>
...
<a href="#" onclick="display('secondbit');return false;">show second</a>

<div id="content">
  <div id="firstbit" class="show">
  ...content...
  </div>
  <div id="firstbit" class="hidden">
  ...content...
  </div>
</div>
0

You can pass the pagename through $_GET.

If you have mod re-write (or similar) you can disguise the $_GET in the URL.

Using $_GET you can define what file you want and use include to display it.

i.e. yoursite.com?page=first or yoursite.com/first.html(using mod re-write)

<?php
$page = $GET['page'];

include $page'.php';
?>

Now if you have a page called first.php with all the info you want displayed on first, yoursite.com?page=first will load it.

NOTE: This will only work for pages on the same server.

Edited by liamfriel: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.