<link> to a css file requires .css ???

<link> to a css file requires .css ???

am 16.08.2009 23:37:47 von Daniel Kolbo

Hello,

I realize this is more of an html question than a php, but I was hoping
someone here would know what's going on.

I am linking to a stylesheet and it is requiring me to use *.css
extension. I want to use a .php extension (and have the php engine
generate css). However, whenever i use a .php extension the link tag
does not seem to work.

This works!
href="http://localhost:8080/some.css" />

This doesn't work but I don't understand why not???
href="http://localhost:8080/some.php" />

The page http://localhost:8080/some.php displays the css exactly the
same as http://localhost:8080/some.css

Why can't I link to a css file by using a different extension?

Thanks in advance,
dK
`

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: <link> to a css file requires .css ???

am 16.08.2009 23:41:53 von Nitsan Bin-Nun

--0016364166ff84e54304714928e2
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Of course not, just send the corresponding mime type to the file extension
..css
Probably header('Content-Type: text/css');

Good luck ;)

On Sun, Aug 16, 2009 at 11:37 PM, Daniel Kolbo wrote:

> Hello,
>
> I realize this is more of an html question than a php, but I was hoping
> someone here would know what's going on.
>
> I am linking to a stylesheet and it is requiring me to use *.css
> extension. I want to use a .php extension (and have the php engine
> generate css). However, whenever i use a .php extension the link tag
> does not seem to work.
>
> This works!
> > href="http://localhost:8080/some.css" />
>
> This doesn't work but I don't understand why not???
> > href="http://localhost:8080/some.php" />
>
> The page http://localhost:8080/some.php displays the css exactly the
> same as http://localhost:8080/some.css
>
> Why can't I link to a css file by using a different extension?
>
> Thanks in advance,
> dK
> `
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--0016364166ff84e54304714928e2--

Re: <link> to a css file requires .css ???

am 16.08.2009 23:44:08 von Adam Shannon

--0016364188478f2f2d04714930cf
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On Sun, Aug 16, 2009 at 4:37 PM, Daniel Kolbo wrote:

> Hello,
>
> I realize this is more of an html question than a php, but I was hoping
> someone here would know what's going on.
>
> I am linking to a stylesheet and it is requiring me to use *.css
> extension. I want to use a .php extension (and have the php engine
> generate css). However, whenever i use a .php extension the link tag
> does not seem to work.
>
> This works!
> > href="http://localhost:8080/some.css" />
>
> This doesn't work but I don't understand why not???
> > href="http://localhost:8080/some.php" />
>
> The page http://localhost:8080/some.php displays the css exactly the
> same as http://localhost:8080/some.css
>
> Why can't I link to a css file by using a different extension?
>
> Thanks in advance,
> dK
> `
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
Oh, I think it's part of the spec. You could always use .htaccess rules to
parse .css files as .php, this will keep search engines happy and browsers
happy as well.

--
- Adam Shannon ( http://ashannon.us )

--0016364188478f2f2d04714930cf--

Re: <link> to a css file requires .css ???

am 16.08.2009 23:44:35 von Daniel Kolbo

Daniel Kolbo wrote:
> Hello,
>
> I realize this is more of an html question than a php, but I was hoping
> someone here would know what's going on.
>
> I am linking to a stylesheet and it is requiring me to use *.css
> extension. I want to use a .php extension (and have the php engine
> generate css). However, whenever i use a .php extension the link tag
> does not seem to work.
>
> This works!
> > href="http://localhost:8080/some.css" />
>
> This doesn't work but I don't understand why not???
> > href="http://localhost:8080/some.php" />
>
> The page http://localhost:8080/some.php displays the css exactly the
> same as http://localhost:8080/some.css
>
> Why can't I link to a css file by using a different extension?
>
> Thanks in advance,
> dK
> `
>
Sorry, I am pretty sure i figured out why. I think it has to do with
Content-Type header.
Thanks,
dK
`

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: <link> to a css file requires .css ???

am 17.08.2009 10:08:59 von Devendra Jadhav

--00c09f899a4d00e6e4047151ea05
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Just use following .htaccess rewrite rule
RewriteRule ^some.css$ some.php
and this is the perfect solution.


On Mon, Aug 17, 2009 at 3:14 AM, Adam Shannon wrote:

> On Sun, Aug 16, 2009 at 4:37 PM, Daniel Kolbo wrote:
>
> > Hello,
> >
> > I realize this is more of an html question than a php, but I was hoping
> > someone here would know what's going on.
> >
> > I am linking to a stylesheet and it is requiring me to use *.css
> > extension. I want to use a .php extension (and have the php engine
> > generate css). However, whenever i use a .php extension the link tag
> > does not seem to work.
> >
> > This works!
> > > > href="http://localhost:8080/some.css" />
> >
> > This doesn't work but I don't understand why not???
> > > > href="http://localhost:8080/some.php" />
> >
> > The page http://localhost:8080/some.php displays the css exactly the
> > same as http://localhost:8080/some.css
> >
> > Why can't I link to a css file by using a different extension?
> >
> > Thanks in advance,
> > dK
> > `
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> Oh, I think it's part of the spec. You could always use .htaccess rules to
> parse .css files as .php, this will keep search engines happy and browsers
> happy as well.
>
> --
> - Adam Shannon ( http://ashannon.us )
>



--
Devendra Jadhav

--00c09f899a4d00e6e4047151ea05--

Re: <link> to a css file requires .css ???

am 17.08.2009 11:54:52 von kranthi

A browser will always parse tag regard less of the
extension. the only condition is that the file should provide a mine
type 'text/css' for css files.

https://developer.mozilla.org/en/Incorrect_MIME_Type_for_CSS _Files

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php