Information Technology Products Blackberry Css Files Php File Php Variables Page Password Traveling Content Management System Formatting Marketing Php Mysql Email Account PHP Joomla News Releases Firefox Echo Bandwidth Usage Html Xmlns Indexing Services Config Php tricks Forefront Tip Web Developer View Source WordPress Download Internet Explorer Federal Employees Doctype Intranet Information Systems Membership Login Development box model Color Scheme Color Schemes PHP Tips Mobile Platforms Import Rant Accurate Time Php Echo World Wide Web Index Design Football Game Colors Working With Clients Email Settings Full Time Adminemail Husker Football Search Engine Optimization Capital Letters organization Social Networking Web Developers Free Download Dashboard XML Addressbook Sql Server Mysql Fetch Array Deans List Dynamic Css Video And Multimedia Work Log App Military Installation Csv Server Username Web Design SEO Lotus Seo Search Engine Optimization mySQL Images Links Cat Id Web Free Variation Select Name Mumbo Jumbo Software Applications Nate Transparent Image Multimedia Products Variables Lotus Notes Templates Honesty Time Web Database Functionality Area 51 Strange Person Longest Time 26b Services Software Transitional Dtd redirect Import Functionality Stylesheet database Database Import Login Php encryption Lt Categories Gsa Gov css Address Book Page Rank Br tips Cms Content Phpmyadmin Divs 2.1 2.6. 2.62 Membership Database Hourly Fee Integrity blog steps Google Hourly Rates Portable Computers Tag rss Lot Microsoft tools Telegraph Habit Reference Transition SQL Insanity Sql Database Ideas Asynchronous Javascript And Xml Password Reset Web Applications Web App Server Hostname Double Benefit Section 508 Gods Gift Last Straw Html Tag AJAX W3c Nuances Telecommunications Products Gsa developer System Administrator Ektron CMS Search Google Headaches Php Password Internet Explorer 7 Mysql Num Rows Fellow Web Screen Resolutions Borders develop Array Branding New Features Time Frame Php Database Export Div Id Strategy Term Relationships Css File Laserjet 4100 University Web Div includes Web Development free templates
Information Technology Products Blackberry Css Files Php File Php Variables Page Password Traveling Content Management System Formatting Marketing Php Mysql Email Account PHP Joomla News Releases Firefox Echo Bandwidth Usage Html Xmlns Indexing Services Config Php tricks Forefront Tip Web Developer View Source WordPress Download Internet Explorer Federal Employees Doctype Intranet Information Systems Membership Login Development box model Color Scheme Color Schemes PHP Tips Mobile Platforms Import Rant Accurate Time Php Echo World Wide Web Index Design Football Game Colors Working With Clients Email Settings Full Time Adminemail Husker Football Search Engine Optimization Capital Letters organization Social Networking Web Developers Free Download Dashboard XML Addressbook Sql Server Mysql Fetch Array Deans List Dynamic Css Video And Multimedia Work Log App Military Installation Csv Server Username Web Design SEO Lotus Seo Search Engine Optimization mySQL Images Links Cat Id Web Free Variation Select Name Mumbo Jumbo Software Applications Nate Transparent Image Multimedia Products Variables Lotus Notes Templates Honesty Time Web Database Functionality Area 51 Strange Person Longest Time 26b Services Software Transitional Dtd redirect Import Functionality Stylesheet database Database Import Login Php encryption Lt Categories Gsa Gov css Address Book Page Rank Br tips Cms Content Phpmyadmin Divs 2.1 2.6. 2.62 Membership Database Hourly Fee Integrity blog steps Google Hourly Rates Portable Computers Tag rss Lot Microsoft tools Telegraph Habit Reference Transition SQL Insanity Sql Database Ideas Asynchronous Javascript And Xml Password Reset Web Applications Web App Server Hostname Double Benefit Section 508 Gods Gift Last Straw Html Tag AJAX W3c Nuances Telecommunications Products Gsa developer System Administrator Ektron CMS Search Google Headaches Php Password Internet Explorer 7 Mysql Num Rows Fellow Web Screen Resolutions Borders develop Array Branding New Features Time Frame Php Database Export Div Id Strategy Term Relationships Css File Laserjet 4100 University Web Div includes Web Development free templates

While working on this site,I decided that it would be cool to have the ability to change the color or design of your website. This thought was quickly diminished when I realized that it would mean that I would need to create a new stylesheet for every color option imaginable….ugh….

What I decided to do was to create an use dynamically generated css files. This was a complete revelation to me and I was completely thrilled to discover this, but a lot of sites out there were misleading and made people take things a bit to far to make it work.

These sites would tell people to make a change to their .htaccess file which would then result in any CSS file on your site to not render properly, requiring you to convert them all to PHP, effectivley making WordPress or any generic install worthless on your site because of the extension problems it creates.

To make this work, simply do the following:

If your stylesheet was originaly named stylesheet.css simply rename it to stylesheet.php and add this to the top of your stylesheet:

<?php Header (“Content-type: text/css”);?>

Thats it. SIMPLE! Now ou can perform any php code within your new css file and it should work without a hitch! Here is an example of how a div may be declared:

<?php $textcolor = #FFFFFF;
$bordercolor = #666666;
?>
div {
 color:<?php echo $textcolor; ?>;
 font-size:12px;
 padding-left: 8px;
 border-left:3px <?php echo $bordercolor; ?> solid;
}

No comments yet.

Would you like to login?