Results 1 to 4 of 4

Thread: reloading part of a page

  1. #1
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default reloading part of a page

    I know I can do this with frames, but how can I click on a link and change the content on a page to something else without reloading the links and header and such.

    I think this can be done with js as well, but I am not familiar with js at all. Can this be done with CSS, html, MySQL, and/or PHP? If not I am willing to start researching js and frames some more.

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    It can be done with remote scripting more commonly known today in javascript by the name AJAX. What it would do would be to request something from the server and update just a portion of the page, rather then the whole page. The con with this is that it is very much like frames, and thus a user can only bookmark the initial page, so it's recommended to only use AJAX when the user would never need to bookmark a page (eg contact page)

    If you use a server-side language like PHP, you would need to reload the entire page, however it gives you the added benefit that you can create template files for your header, footer, navigation/menu and include them into the page. Unlike AJAX using php includes gives the ability to bookmark individual pages.
    While you are still sending a request for the templated pages upon every click, those template pages will be saved in cache, unless disabled, so the browser would not need to download those portions again.

    HTML just provides the structure of a page, and cannot perform and real-time action, CSS is used for styling the layout of the page, and MySQL is used for storing data. You would need to use a server-side language like PHP/Python/Ruby or a client-side language like Javascript to perform this action.

    My suggestion is to use PHP includes because it gives you the benefit of being able to bookmark individual pages, and it will keep your template files the same.

  3. #3
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Thanks for the very thorough answer. I didn't know that browsers normally save the include files in the cache. I think I will stick with using includes now. It is what I am used to. Ajax files I am not familiar with, but I like the idea of bookmarking pages better anyway.

  4. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    You can also do it with an iframe, like here. But php seems most natural.

    Arie Molendijk.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •