brainsmasher
July 16th, 2006, 08:04 AM
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
Can any1 help me with this
|
Click to See Complete Forum and Search --> : changing includes brainsmasher July 16th, 2006, 08:04 AM 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 Dr. Script July 16th, 2006, 09:21 AM 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. brainsmasher July 16th, 2006, 10:09 AM 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. Dr. Script July 16th, 2006, 12:11 PM 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? gitter1226 July 17th, 2006, 01:33 PM 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 codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |