1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Rep Power

    CSS for chosen item in menu

    I currently reload my website for every menu item selected with php. ie if the user clicks page2 I reload a page top, nav sidebar, page footer and then using php include I load in the content for page2. Of course in practice the page top, nav sidebar and page footer are recalled from cache so they do not blink and the user is only aware of the content part of the page changing the way it should be.

    Having just begun to get to grips with CSS for positioning I am in the process of converting my site from a 1990's table layout to CSS layout. I wonder if there is a way to call in page content with CSS as opposed to php include statements.

    Any help greatly appreciated.
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    The Pleiades
    Rep Power
    Good afternoon,

    Are you familiar with Ajax?

    I don't see a problem with using includes to load in page content?

    Keep your HTML in separate files in a directory somewhere and depending on the link clicked ($_GET var passed), load in the relevant content.

    I think what you have described that Ajax would be your best option?

    You can't do it with CSS I'm sure.

    Kind regards,

  4. #3
  5. CSS & JS/DOM Adept
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jul 2004
    USA (verifiably)
    Rep Power
    Garry where are you saying the files included via PHP are cached?

    Anyway, as Nanomech said, CSS can't do that since that is well beyond the scope of the purpose of CSS.

    One thing about using AJAX is it makes the first page load take longer by requiring more JavaScript. I recommend only using AJAX for this if you have strong evidence showing it makes a very significant improvement for additional page visits in the same browsing session.
    Spreading knowledge, one newbie at a time.

    Learn CSS. | PHP includes | HTML Validator | CSS validator

    Remember people spend most of their time on other people's sites (so don't violate web design conventions).

IMN logo majestic logo threadwatch logo seochat tools logo