|
-
July 16th, 2006, 08:04 AM
#1
changing includes
I need the code for when i press an button it changes some includes on the page, so its some kind of navigating.
Can any1 help me with this
-
July 16th, 2006, 09:21 AM
#2
Re: changing includes
Well, it couldn't just change it on the spot, it would have to at least reload the entire page, if not change the page again. If thats the case, get a parameter from the URL string like: navigate?pg=home. Make the include: ($_GET["pg"] . ".php") . You'd have to add more code to check the validity of pg and to make sure it exists.
*9-11-01* Never Forget; Never Forgive; Never Relent!
"If we ever forget that we're one nation under God, then we will be a nation gone under." - Ronald Reagan
-
July 16th, 2006, 10:09 AM
#3
Re: changing includes
Is there an easier way to navigate true pages without loading all the other includes again, or is this not possible?
The page always has the same menu, header and footer so only the middle part of the page needs to change.
Last edited by brainsmasher; July 16th, 2006 at 10:34 AM.
-
July 16th, 2006, 12:11 PM
#4
Re: changing includes
You would either load every page and simply use the button to activate a JavaScript that would alter the page being viewed. Each time you click, you'd move the one you clicked on to the top of view. That wouldn't work universally, while includes would, so you'd have to do it all again.
Typically though, you'd have a menu, and that would be like menu.php, and then a header and fotoer, header.php, footer.php, and each page would include these where needed. You seem to be doing it where you have one page and it includes these pages, but also the main content, where it probably makes more sense just to link to the main content page (like home.php, contact.php, forum.php, etc) and those would have within them the includes for the menu, header, and footer.
Follow?
*9-11-01* Never Forget; Never Forgive; Never Relent!
"If we ever forget that we're one nation under God, then we will be a nation gone under." - Ronald Reagan
-
July 17th, 2006, 01:33 PM
#5
Re: changing includes
You should look into AJAX brainsmasher. You can attach a javascript event to a function that uses the XMLHttpRequest object to make a behind-the-scenes call to your server side script and specify the Javascript callback function. The use that Javascript function to manipulate the DOM and insert the content you want to display. This is the best way I know of to do this.
HTH,
Jeff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|