7 Replies Latest reply: Jul 31, 2012 11:25 AM by MurraySummers RSS

    CSS needs PHP to execute in order to render in Dreamweaver CS6

    jwcalvert Community Member

      When I view my web pages while in Dreamweaver, I need a piece of PHP code ( called ws_general.php ) to execute in order for the CSS to render.

      The pages do look fine when in a browser but I would like to solve this to better test my pages while in Dreaweaver.

       

      I have looked through various solutions but with no luck.

       

      I am using:  Windows 7 SP1

      Dreamweaver CS6, build 5842

       

      Thanks

        • 1. Re: CSS needs PHP to execute in order to render in Dreamweaver CS6
          MurraySummers CommunityMVP

          Let's see the code on your page (a link to the live page would be a good start, but if PHP is involved, we'll need to see the raw code as well).  By default, DW does not require any PHP to render CSS properly.

          • 2. Re: CSS needs PHP to execute in order to render in Dreamweaver CS6
            jwcalvert Community Member

            Murray,

            The raw code at the top of my page is as follows:

             

            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head>

            <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

            <title>Jim Calvert Photographer - My Images</title>

                <meta name="description" content="Photography has been a modest pastime for most of my adult life but recently became a serious passion.  I feel very much at home outdoors in natural surroundings and enjoy the rewards of all-season photography">

                <meta name="keywords" content="Jim Calvert, wildlife, photography, landscapes, Mississauga, Canada ">   

                <meta http-equiv="content-language" content="en-ca">

                <meta name="copyright" content="Jim Calvert Photographer">

                <meta name="company" content="Lanmax Computer Solutions Inc.">

                <meta name="robots" content="index, follow">

                <meta name="Language" content="English">

             

                <link rel="stylesheet" type="text/css" media="all" href="ws_css/ws_general.php">                     <<<<<<<<<<<< this is the php that needs to run !

                <script type="text/javascript" src="ws_javascripts/rotator.js"></script>

             

             

            <style type="text/css">

            .style23 {

                font-size: 1.4em

            }

            </style></head><body onload="rotateImage('RandPic')">

             

            <div id="wrapper">

             

                <div id="top">

            ......... etc, etc..

             

             

            And the ws_general.php code is:

             

            <?php

            /*

            Burning Foliage Colour Scheme

            Dark Green    #394635

            Green        #6D7D59

            MyGreen        #2AB305

            Light Green    #B8C39E

            Beige        #F1F2DB

            Light Beige    #ECD77A

            Light Brown    #CD9644

            Brown        #8A5823

            Dark Brown    #513311

            Very Dark Brown #1F1306

            */

             

            header("Content-type: text/css");

            $main_bkgd = '#1F1306';

            $def_text = '#F1F2DB';

            $other_text = '#ECD77A';

            $link_text = '#2AB305';  /* 2010.08.23  */

            $borders = '#8A5823';

            $titles = '#CD9644';

            $def_menu = '#B8C39E';

             

            ?>

             

            /* Standard styles */

            /***********************************************************************/

            body {

                position: relative;

                text-align: left;

                margin: 0;

                padding: 0;

                font:62.5%  Georgia, Lucida Grande, Lucida Sans Unicode, trebuchet ms, Arial,Helvetica,sans-serif;

                color: <?=$def_text?>;

                background-color: <?=$main_bkgd?>;

                background-position: top left;

                background-repeat: repeat-x;

            }

            p {font-size: 1.2em; font-weight: normal; text-decoration: none; line-height: 1.7em; color:<?=$def_text?>; margin: 0; padding: 0 0 .7em 0; }

            h1, h2, h3 {font-weight: normal; }

            h1 {font-size: 1em; paddi..........etc, etc

             

             

            Does this help?

            Cheers

            • 3. Re: CSS needs PHP to execute in order to render in Dreamweaver CS6
              MurraySummers CommunityMVP

              Yes - that helps.  You will not see the CSS rendered in Design view when it is generated on the fly as you show here.  However, you can make use of a design-time stylesheet to cause DW to explicitly load another stylesheet which is used to render the page for Design view.  This "DT Stylesheet" would contain the rules/styles as generated from this PHP file.  While not optimal (since there are two separate stylesheets involved here, you would have to keep them synched for your local display), it is quite workable.  Does that help?

              • 4. Re: CSS needs PHP to execute in order to render in Dreamweaver CS6
                Jon Fritz II CommunityMVP

                Is there a specific reason you are using php in there? It seems needlessly complex since all you're doing is defining CSS attributes with it.

                 

                I would turn it into a .css file, then move all of the defined colors and other attributes to their proper positions in place of the php snippets. That will work correctly in DW then.

                • 5. Re: CSS needs PHP to execute in order to render in Dreamweaver CS6
                  jwcalvert Community Member

                  Murray,

                  Thanks for the tip on the DT sheet.  I will try that.

                  Cheers

                  • 6. Re: CSS needs PHP to execute in order to render in Dreamweaver CS6
                    jwcalvert Community Member

                    Jon,

                    My goal was to make the colours dynamically adjustable and have them set in a single location.

                    I am a novice at CSS so there probably are better ways than this.

                     

                    Cheers

                    • 7. Re: CSS needs PHP to execute in order to render in Dreamweaver CS6
                      MurraySummers CommunityMVP

                      Your use of PHP to give you this option is the only way to achieve your stated goals that I know of.  The price you pay for this convenience may be too high, though.