Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    46
    Thanks
    7
    Thanked 0 Times in 0 Posts

    style.css.php to just style.css?

    I was wondering if.. I could change the file extension of style.css.php to just style.css.. The file is this

    Code:
    <?php
    header("content-type: text/css");
    $style=$_GET['style'];
    ?>
      <?php
    if($style=="")
     {
    ?>
    File not found.
    <?php
      }
    if($style=="one")
     {
    ?>
    body {
    	margin: 0;
    	padding: 0;
    	background: #024855 url(http://envy-layouts.com/style/pinkstripes.gif);
    	background-position: top left;
    	background-repeat: repeat;
    	background-attachment: fixed;
    	text-align: justify;
    	font-family: Arial, Helvetica, sans-serif;
    	font-size: 12px;
    	color: #404040;
    }
    #placement  {
       margin: 0px auto 0px auto;
       width: 811px;
       position: relative;
    }
    
    <?php
      }
    end
    ?>
    which results in style.css.php?style=one
    wanting style.css?style=one

  • #2
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Create a .htaccess file with the following line, or add the following line to your current .htaccess:
    Code:
    addtype application/x-httpd-php .css
    Last edited by kbluhm; 01-04-2008 at 09:55 PM.

  • #3
    Senior Coder
    Join Date
    Jan 2007
    Posts
    1,648
    Thanks
    1
    Thanked 58 Times in 54 Posts
    It would be more efficient to keep the file as .css.php and add a header() call to tell the browser it is a CSS file.

  • #4
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Obviously.


  •  

    Posting Permissions

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