CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2006
    Location
    The Netherlands
    Posts
    108

    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

  2. #2
    Join Date
    May 2004
    Location
    MN / NJ, United States
    Posts
    768

    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

  3. #3
    Join Date
    Jul 2006
    Location
    The Netherlands
    Posts
    108

    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.

  4. #4
    Join Date
    May 2004
    Location
    MN / NJ, United States
    Posts
    768

    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

  5. #5
    Join Date
    Aug 2005
    Location
    Milwaukee, WI
    Posts
    55

    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
  •  





Click Here to Expand Forum to Full Width

Featured