Re: including CSS & JS on only pages that need that CSS & JS [message #175579 is a reply to message #175577] |
Mon, 10 October 2011 03:43 |
Mr. B-o-B
Messages: 42 Registered: April 2011
Karma:
|
Member |
|
|
On 10/9/2011 6:54 PM, Jerry Stuckle cried from the depths of the abyss:
>
> None of which are a good idea. And so those who keep espousing these
> crappy solutions (which are off topic in this newsgroup but there are so
> many of them I will respond anyway):
So just ignore them then :)
> And files should be included using link tags, not directly included in
> the source file directly (unless they are specific to this page - in
> which case there is no need for conditional includes). That way file can
> be cached by the browser and/or routers between the web server and the
> client, decreasing both network traffic and server load.
>
Again, my original post fits these specs:
if (@isset $jerrys_css) {
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"jerry_css.css\"
/>";
}
Then just set $jerry_css = 1 when needed. Imagine that. You are not
decreasing network traffic, not increasing server load, cache is
irrelevant as it's only cached in the pages that need it, you are using
..js/.css via link tags.
|
|
|