Hi folks,
I have a website with linked CSS files controlling layout, via LINK
tags. In these linked CSS files, I need to create dynamic styles. This
is a website of articles, and for every article type in the MySQL
database, I need another style.
..article-type-0{color:red;}
..article-type-1{color:red;} etc.
I could use PHP in the HTML head to write styles, but I'm using the
media attribute of the LINK tag to control which styles go to which
output devices. Therefore, I'd like to use PHP to author a linked CSS
file.
Being an idiot, I had figured I could update my httpd.conf file (apache
2/redhat 8) and rewrite an AddType line to read:
AddType application/x-httpd-php .php .htm .html .css
It kind of worked. Almost. In fact, calling up the CSS in a browser
window showed that PHP did take over when asked and wrote my
article-type classes into the right places, using valid CSS.
However, once I did that, the web pages displayed as though no CSS file
were present.
Which tweak to httpd.conf or php.ini do I need to get PHP function in a
linked CSS file?
Thanks,
-Dan 2 2224 dm*******@yahoo.com wrote: Hi folks,
I have a website with linked CSS files controlling layout, via LINK tags. In these linked CSS files, I need to create dynamic styles. This is a website of articles, and for every article type in the MySQL database, I need another style.
.article-type-0{color:red;} .article-type-1{color:red;} etc.
I could use PHP in the HTML head to write styles, but I'm using the media attribute of the LINK tag to control which styles go to which output devices. Therefore, I'd like to use PHP to author a linked CSS file.
Being an idiot, I had figured I could update my httpd.conf file (apache 2/redhat 8) and rewrite an AddType line to read:
AddType application/x-httpd-php .php .htm .html .css
It kind of worked. Almost. In fact, calling up the CSS in a browser window showed that PHP did take over when asked and wrote my article-type classes into the right places, using valid CSS.
However, once I did that, the web pages displayed as though no CSS file were present.
Maybe this works: Put
<?php
header("Content-Type: text/css");
?>
at the top of every .css file, so that the browser knows that it's
dealing with a CSS stylesheet. Which tweak to httpd.conf or php.ini do I need to get PHP function in a linked CSS file?
Thanks, -Dan
Dani CS wrote: dm*******@yahoo.com wrote: Hi folks,
I have a website with linked CSS files controlling layout, via LINK tags. In these linked CSS files, I need to create dynamic styles.
This is a website of articles, and for every article type in the MySQL database, I need another style.
.article-type-0{color:red;} .article-type-1{color:red;} etc.
I could use PHP in the HTML head to write styles, but I'm using the media attribute of the LINK tag to control which styles go to
which output devices. Therefore, I'd like to use PHP to author a linked
CSS file.
Being an idiot, I had figured I could update my httpd.conf file
(apache 2/redhat 8) and rewrite an AddType line to read:
AddType application/x-httpd-php .php .htm .html .css
It kind of worked. Almost. In fact, calling up the CSS in a browser window showed that PHP did take over when asked and wrote my article-type classes into the right places, using valid CSS.
However, once I did that, the web pages displayed as though no CSS
file were present.
Maybe this works: Put
<?php header("Content-Type: text/css"); ?>
at the top of every .css file, so that the browser knows that it's dealing with a CSS stylesheet.
Which tweak to httpd.conf or php.ini do I need to get PHP function
in a linked CSS file?
Thanks, -Dan
That worked exceptionally well.
Much appreciated,
-Dan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: junkmail |
last post by:
on a win 2k server
apparantly it is saying i dont have it. or it cant find it.
im using mySQL 4.1
php 4.3.x
apache 3.0.53
im new to php and am doing some tutorials, but when i run the sripts...
|
by: Ref |
last post by:
Hi
I am new with Replication
I develop Now the Microsoft Server 2000 Replication
And I chose Snapshot type for replication
All I need to copy Part of db from Publisher via distributor to...
|
by: Markus Wollny |
last post by:
Hello!
When I try to run ./configure --with-java, it complains that ant doesn't
work. However ant is installed, as is the latest Java SDK 1.4.2 from
sun, PATH and JAVA_HOME are set correctly;
...
|
by: Markus Wollny |
last post by:
Hi!
I am trying to build PostgreSQL 7.4.3 with Java enabled; I've got Apache
Ant version 1.5 and j2sdk1.4.1_05 installed:
Verifiying ant:
# which javac
/usr/java/j2sdk1.4.1_05/bin/javac
#...
|
by: msuemnig |
last post by:
I've create an Ubuntu Linux box, which comes pre-installed with Python
(I've added the libapache2-mod-python throught the app manager). I've
created .cgi and .py simple programs in the www root...
|
by: david |
last post by:
I have developed web forms including login by using ASP.NET via HTTP.
Now I want to secure the connection from client to the server via HTTPS.
How can I configure the server or something else to...
|
by: tito |
last post by:
I have already installed Active Perl and Apache Websever (HTTP Server 2.2.4) in Wndows XP.Both these are working individually means Apache is started successfully,Active Perl is also working...
|
by: gquiring |
last post by:
I have a new server running CentOS 5.1. I was surprised the stock
PHP excludes MySQL, PDO and a bunch of other popular modules. I
decided to download the source and compile a version with the...
|
by: kodaliece |
last post by:
Hi,
I am new to this PHP and linux OS as well. I am trying to install to
Apache 2.2.8 and PHP 5.2.5 and do some PHP coding. I've installed
Apache and tested it. Its working fine. Then, I...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |