PDA

View Full Version : Replacing a single <div>'s contents


CarlHasAProblem
07-18-2007, 12:10 AM
Here is an example to visually show the situation: http://www.cashmgmt.com/new.0/about.php

The main contents for the About page (within the white portion of the page and contained within <div id="content">) are included using a standard <?php include(""); ?>. The idea here is of course to have a page that remains in place without having to load anew every time you click a link. I would like to replace these contents (within the white section) with external pages when you click a link (such as Home, Contact, or About) by ONLY REPLACING that white section.


Since I have virtually no knowledge of PHP coding, I am going to try to just explain what I essentially have in my head for something I might need...

Something along these lines: "on clicking a link, replace contents of <div id="content"> with contact.php"

-or-

include a variable in <?php include(""); ?> (such as <?php include("variable"); ?>) and do something along these lines: on clicking the link, variable="contact.php" and on clicking another link variable="home.php"


That was just my attempt to explain what I'm trying to do a little more easily (though I'm sure it made things worse :)). What PHP/XML functions do I need to make this happen, and what do I need to use in the href property to call these functions? I have never done anything along these lines before, and am unfortunately in need of a beginner's explanation :(. I have seen this done extremely often, so I imagine there is a relatively simple solution – it is this simplest solution that I am looking for.

Thank you for taking the time to read this incredibly long request! Time is of the essence, and any help would be GREATLY appreciated. Thank you very much in advance,

Carl

_Aerospace_Eng_
07-18-2007, 09:43 AM
You are likely going to have to use ajax for this. http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm