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

    Join Date
    Sep 2013
    Posts
    6
    Rep Power
    0

    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
    Location
    The Pleiades
    Posts
    294
    Rep Power
    8
    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,

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

    Join Date
    Jul 2004
    Location
    USA (verifiably)
    Posts
    20,122
    Rep Power
    4258
    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.

    Check out my blog. | Learn CSS. | PHP includes | X/HTML Validator | CSS validator | Common CSS Mistakes | Common JS Mistakes

    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