• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

Link or SSI for css ?

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    Link or SSI for css ?

    Would the congregation please vote on which method they would use for including CSS into a web page giving reasons for choice.

    I know of two options and can't decide which is the better choice. The style sheets in question are small and simple (about 4k) which will probably affect the choice.

    Should I use
    Code:
     <******"StyleSheet" href="************.css">
    which will increase the number of server httprequests or an SSI which will increase the size of every page.

    The same css is used throughout the site.

    #2
    tech lesson for fiddle

    from client (visitor) point of view its much better to have usual <link> reference, and here is why:

    * it will be cached after 1st HTTPrequest, this will reduce bandwidth usage for site and make things faster for use.

    * SSI is an old skool - dont have links at hand but I believe that overall its not very efficient thing to do at all as webserver will have to parse pages (perhaps once unless page changed on disk if they are smart).

    * reserved for future use.

    Given how arsey you were about saving bits of bandwidth by employing frames I'd imagine it would be a no brainer for you to accept my qualified opinion on the matter

    Comment


      #3
      re

      1st one, because it's less complicated and bandwidth consumption is negligible anyway.

      Comment


        #4
        Re: re

        Both are simple and the pages will be parsed anyway as virtually all are type php because they have bits of php code in them.

        What it boils down to is...

        using the link will decrease bandwidth but will lead to more httprequests

        using the ssi (actually I'd use a php include) will increase bandwidth.

        You both more or less just confirmed what I said in the initial post and expanded on in this one. I'm looking for any big reason to choose one over the other.

        Actually I use both (in different sites) and thought I'd maybe tidy it up and use the same method in all my sites.

        Comment


          #5
          Link.
          Why? Because performance/benifit difference between two is minimal but at least with link if someone else comes along later they will most likely be more familiar with the link method which will make it easyer for them to figure out just what the hell you were doing.

          Comment


            #6
            re

            "I'm looking for any big reason to choose one over the other. "

            Well, you'll be looking a long time.

            Comment


              #7
              page views per visitor

              > using the link will decrease bandwidth but will lead to more uests

              This sort of things depend on actual usage patterns. I'd look at number of page views per visitor - if its greater than 1 then there will be good savings from using link rather than SSI.

              note that good PHP mod keeps parsed bytecode in memory, and even if it parses it all the time then no need to add additional parsing code again before passing to bytecode parsed version of PHP.

              Big reason - SSI is old and obsolete, there is no need to use it and its a BIG reason.

              If you are so anal about embedding CSS code inside file then bloody use PHP's includes!

              Comment


                #8
                phpAccelerator

                There, free OSS phpAccelerator - www.phpaccelerator.co.uk/

                Like commercial version of Zend it does not recompile unchanged php scripts. So, this would speed things up and eliminate need for using SSI complete.

                The only real choice is whether to embed CSS or not - static files served by web servers very fast, its not expensive kind of HTTPrequest at all (yes I did some serious load testing and know what I am talking about), use average page views per visitor as a good indication of potential savings due to client side caching.

                Comment


                  #9
                  Re: phpAccelerator

                  > If you are so anal about embedding CSS code inside file then bloody use PHP's includes!

                  not sure what you mean by this.

                  Site A uses ..
                  ******"StyleSheet" href="style.css"

                  Site B uses ..
                  ?php include("style.css"); ?

                  neither embed the style in the page which would be stupid and cause a maintenance nightmare.

                  The reason I code B like that was because at the time I'd forgotten the syntax for A

                  I doubt there's tuppence of difference between the two from what has been said but I'll still probably recode as A just to keep them consistant (there are several other sites coded like A)

                  I just wanted to know if the include was better for some reason - in which case I'd have changed the others.

                  All your wittering about saving the parsed results is completely irrelevant to this - you are trying to think too deeply about a very simple question.

                  Comment


                    #10
                    which include?

                    > I just wanted to know if the include was better for
                    > some reason - in which case I'd have changed the others.

                    which "include" you mean? Reference which would force browser to separately request CSS file (and then cache it) or embedding of CSS code by means of SSI or PHP includes?

                    The latter should do the same job as SSI.

                    You seem to be unable to comperehend that referencing CSS file in HTML as in Site A example you gave above is an overall better option which in some heavy traffic instances can have an overwhelming advantage and therefore it is stupid not to do it as a matter of good practice that can pay up later big.

                    Just like looking over the shoulder to check blind spots - most of time its a complete waste however once in a while it can save lots of £££££££££

                    Comment

                    Working...
                    X