Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3340 > unrolled thread
| Started by | paris2venice <paris2venice@gmail.com> |
|---|---|
| First post | 2011-10-08 23:51 -0700 |
| Last post | 2011-10-12 06:20 -0400 |
| Articles | 20 on this page of 39 — 11 participants |
Back to article view | Back to comp.lang.php
including CSS & JS on only pages that need that CSS & JS paris2venice <paris2venice@gmail.com> - 2011-10-08 23:51 -0700
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-09 08:34 -0400
Re: including CSS & JS on only pages that need that CSS & JS paris2venice <paris2venice@gmail.com> - 2011-10-10 02:22 -0700
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-10 08:27 -0400
Re: including CSS & JS on only pages that need that CSS & JS "Mr. B-o-B" <wtf.chuck@gmail.com> - 2011-10-09 08:46 -0500
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-09 13:52 -0400
Re: including CSS & JS on only pages that need that CSS & JS Luuk <Luuk@invalid.lan> - 2011-10-09 20:03 +0200
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-09 15:08 -0400
Re: including CSS & JS on only pages that need that CSS & JS Michael Joel <no@please.com> - 2011-10-09 16:31 -0400
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-09 19:54 -0400
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-09 20:03 -0400
Re: including CSS & JS on only pages that need that CSS & JS "Mr. B-o-B" <wtf.chuck@gmail.com> - 2011-10-09 22:43 -0500
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-10 08:30 -0400
Re: including CSS & JS on only pages that need that CSS & JS Michael Joel <no@please.com> - 2011-10-10 13:04 -0400
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-10 13:44 -0400
Re: including CSS & JS on only pages that need that CSS & JS "Mr. B-o-B" <wtf.chuck@gmail.com> - 2011-10-10 21:35 -0500
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-10 23:04 -0400
Re: including CSS & JS on only pages that need that CSS & JS "Mr. B-o-B" <wtf.chuck@gmail.com> - 2011-10-10 22:14 -0500
Re: including CSS & JS on only pages that need that CSS & JS Michael Joel <no@please.com> - 2011-10-10 23:24 -0400
Re: including CSS & JS on only pages that need that CSS & JS Tim Streater <timstreater@greenbee.net> - 2011-10-11 10:33 +0100
Re: including CSS & JS on only pages that need that CSS & JS The Natural Philosopher <tnp@invalid.invalid> - 2011-10-11 11:29 +0100
Re: including CSS & JS on only pages that need that CSS & JS Tim Streater <timstreater@greenbee.net> - 2011-10-11 12:00 +0100
Re: including CSS & JS on only pages that need that CSS & JS The Natural Philosopher <tnp@invalid.invalid> - 2011-10-10 19:34 +0100
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-10 15:16 -0400
Re: including CSS & JS on only pages that need that CSS & JS Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-10 23:17 +0200
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-10 17:36 -0400
Re: including CSS & JS on only pages that need that CSS & JS Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-11 09:09 +0000
Re: including CSS & JS on only pages that need that CSS & JS Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-11 14:11 +0200
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-11 09:08 -0400
Re: including CSS & JS on only pages that need that CSS & JS "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2011-10-11 13:29 +0000
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-11 13:14 -0400
Re: including CSS & JS on only pages that need that CSS & JS Denis McMahon <denismfmcmahon@gmail.com> - 2011-10-11 19:14 +0000
Re: including CSS & JS on only pages that need that CSS & JS Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-10-11 22:38 +0200
Re: including CSS & JS on only pages that need that CSS & JS paris2venice <paris2venice@gmail.com> - 2011-10-11 17:48 -0700
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-11 21:51 -0400
Re: including CSS & JS on only pages that need that CSS & JS paris2venice <paris2venice@gmail.com> - 2011-10-11 22:03 -0700
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-12 06:19 -0400
Re: including CSS & JS on only pages that need that CSS & JS Hans Olo <doctor@vaderlishious.com> - 2011-10-11 22:11 -0500
Re: including CSS & JS on only pages that need that CSS & JS Jerry Stuckle <jstucklex@attglobal.net> - 2011-10-12 06:20 -0400
Page 1 of 2 [1] 2 Next page →
| From | paris2venice <paris2venice@gmail.com> |
|---|---|
| Date | 2011-10-08 23:51 -0700 |
| Subject | including CSS & JS on only pages that need that CSS & JS |
| Message-ID | <e3d8f6c1-a54c-436b-930e-44dd89997f12@v18g2000pri.googlegroups.com> |
I'm still a newbie at PHP. What would be the right way to include CSS and Javascript such that I could add CSS and JS just for those pages that need it? Would it be something like this? Is this how you do it? <? php require_once './css.php'; /* css.php contains doctype, meta & css needed universally */ ?> <!-- link href= calls to CSS needed on local page only --> <? php require_once './js.php'; /* js.php contains javascript calls needed universally */ ?> <!-- script type="text/javascript" calls to Javascript needed on local page only --> </head> Thanks a bunch for your help.
[toc] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-09 08:34 -0400 |
| Message-ID | <j6s4bs$ra8$1@dont-email.me> |
| In reply to | #3340 |
On 10/9/2011 2:51 AM, paris2venice wrote: > I'm still a newbie at PHP. What would be the right way to include CSS > and Javascript such that I could add CSS and JS just for those pages > that need it? > > Would it be something like this? Is this how you do it? > > <? > php require_once './css.php'; /* css.php contains > doctype, meta& css needed universally */ > ?> > > <!-- link href= calls to CSS needed on local page only --> > > <? > php require_once './js.php'; /* js.php contains > javascript calls needed universally */ > ?> > > <!-- script type="text/javascript" calls to Javascript needed on > local page only --> > </head> > > > Thanks a bunch for your help. I'm not sure what you're trying to do here, but these aren't PHP questions. You're only using PHP to include the files. You're asking basic layout file layout questions, which vary widely. The includes can be done in many ways. The first thing you need to do is learn about various ways to structure your files. For instance, don't mix your DOCTYPE and other header information with CSS. I would suggest you start with a book on basic programming for the web, including html, css, etc. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | paris2venice <paris2venice@gmail.com> |
|---|---|
| Date | 2011-10-10 02:22 -0700 |
| Message-ID | <b5300959-4417-40c1-9ce2-9903e7aed559@k25g2000prf.googlegroups.com> |
| In reply to | #3344 |
On Oct 9, 5:34 am, Jerry Stuckle <jstuck...@attglobal.net> wrote: > On 10/9/2011 2:51 AM, paris2venice wrote: > > > > > > > > > > > I'm still a newbie at PHP. What would be the right way to include CSS > > and Javascript such that I could add CSS and JS just for those pages > > that need it? > > > Would it be something like this? Is this how you do it? > > > <? > > php require_once './css.php'; /* css.php contains > > doctype, meta& css needed universally */ > > ?> > > > <!-- link href= calls to CSS needed on local page only --> > > > <? > > php require_once './js.php'; /* js.php contains > > javascript calls needed universally */ > > ?> > > > <!-- script type="text/javascript" calls to Javascript needed on > > local page only --> > > </head> > > > Thanks a bunch for your help. > > I'm not sure what you're trying to do here, but these aren't PHP > questions. You're only using PHP to include the files. > > You're asking basic layout file layout questions, which vary widely. > The includes can be done in many ways. > > The first thing you need to do is learn about various ways to structure > your files. For instance, don't mix your DOCTYPE and other header > information with CSS. > > I would suggest you start with a book on basic programming for the web, > including html, css, etc. Thanks for your reply. I don't understand how you believe that I'm mixing my DOCTYPE and other header info with CSS. What the server sends to the client should be all that matters and that all arrives perfectly and has never been a problem -- validator.w3.org doesn't have an issue with it. I don't mind that you tell me there's some problem but how can I know why there is a problem if it's not spelled out? That doesn't mean I don't appreciate your help. I do. My problem is just not being able to have something unique to a page as I do it now. Thus, my post. If I posted this on an HTML or CSS or JS newsgroup, they would go bananas, I guarantee it. I've read a huge amount on php.net/manual -- it doesn't really answer questions like this as best I can tell. And I'm not really a beginner -- just nothing compared to what you guys know about PHP.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-10 08:27 -0400 |
| Message-ID | <j6uocg$h4o$1@dont-email.me> |
| In reply to | #3360 |
On 10/10/2011 5:22 AM, paris2venice wrote:
> On Oct 9, 5:34 am, Jerry Stuckle<jstuck...@attglobal.net> wrote:
>> On 10/9/2011 2:51 AM, paris2venice wrote:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>> I'm still a newbie at PHP. What would be the right way to include CSS
>>> and Javascript such that I could add CSS and JS just for those pages
>>> that need it?
>>
>>> Would it be something like this? Is this how you do it?
>>
>>> <?
>>> php require_once './css.php'; /* css.php contains
>>> doctype, meta& css needed universally */
>>> ?>
>>
>>> <!-- link href= calls to CSS needed on local page only -->
>>
>>> <?
>>> php require_once './js.php'; /* js.php contains
>>> javascript calls needed universally */
>>> ?>
>>
>>> <!-- script type="text/javascript" calls to Javascript needed on
>>> local page only -->
>>> </head>
>>
>>> Thanks a bunch for your help.
>>
>> I'm not sure what you're trying to do here, but these aren't PHP
>> questions. You're only using PHP to include the files.
>>
>> You're asking basic layout file layout questions, which vary widely.
>> The includes can be done in many ways.
>>
>> The first thing you need to do is learn about various ways to structure
>> your files. For instance, don't mix your DOCTYPE and other header
>> information with CSS.
>>
>> I would suggest you start with a book on basic programming for the web,
>> including html, css, etc.
>
> Thanks for your reply.
>
> I don't understand how you believe that I'm mixing my DOCTYPE and
> other header info with CSS. What the server sends to the client
> should be all that matters and that all arrives perfectly and has
> never been a problem -- validator.w3.org doesn't have an issue with
> it. I don't mind that you tell me there's some problem but how can I
> know why there is a problem if it's not spelled out? That doesn't
> mean I don't appreciate your help. I do.
>
You said:
---
<?
php require_once './css.php'; /* css.php contains
doctype, meta & css needed universally */
?>
---
You are mixing your DOCTYPE and other header information with CSS. Not
a good idea.
As for validating - you could have your entire PHP file be include()
calls, each one including a different file containing one line of PHP or
HTML code. The final product will validate. But that doesn't mean it's
a good idea.
> My problem is just not being able to have something unique to a page
> as I do it now. Thus, my post. If I posted this on an HTML or CSS or
> JS newsgroup, they would go bananas, I guarantee it. I've read a huge
> amount on php.net/manual -- it doesn't really answer questions like
> this as best I can tell. And I'm not really a beginner -- just
> nothing compared to what you guys know about PHP.
>
>
This has nothing to do with PHP. Your problem is a lack of
understanding on how to correctly structure your pages. You could have
exactly the same problems if you were using Perl, Python, Ruby on Rails
or even SSI.
That's why I'm suggesting you start with HTML, CSS and Javascript
newsgroups. You need to learn how to properly structure your pages.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | "Mr. B-o-B" <wtf.chuck@gmail.com> |
|---|---|
| Date | 2011-10-09 08:46 -0500 |
| Message-ID | <eDhkq.5078$aL3.489@newsfe22.iad> |
| In reply to | #3340 |
On 10/9/2011 1:51 AM, paris2venice cried from the depths of the abyss:
> I'm still a newbie at PHP. What would be the right way to include CSS
> and Javascript such that I could add CSS and JS just for those pages
> that need it?
>
> Would it be something like this? Is this how you do it?
>
> <?
> php require_once './css.php'; /* css.php contains
> doctype, meta& css needed universally */
> ?>
>
> <!-- link href= calls to CSS needed on local page only -->
>
> <?
> php require_once './js.php'; /* js.php contains
> javascript calls needed universally */
> ?>
>
> <!-- script type="text/javascript" calls to Javascript needed on
> local page only -->
> </head>
As Jerry mentioned separate DOCTYPE from your CSS for starter. Mixing
nonrelated things just leads to a clusterf*ck down the road. Keep it
seperate/keep it clean. It's worth it in the long run.
An easy way to pull this off is to put all your javascripts and css into
a header type file like so (each CSS & JS seperately):
if (@isset $javascript01){
put code here
}
if (@isset $javascript02){
put code here
}
if (@isset $css01){
put code here
}
etc....
On your pages include the header file. Then on the pages/files you need
to use the $javascript01 & or $css01, just set the variable name you
created in the header file:
$javascript01 = 1
Just that easy.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-09 13:52 -0400 |
| Message-ID | <j6sn1m$lou$1@dont-email.me> |
| In reply to | #3345 |
On 10/9/2011 9:46 AM, Mr. B-o-B wrote:
> On 10/9/2011 1:51 AM, paris2venice cried from the depths of the abyss:
>> I'm still a newbie at PHP. What would be the right way to include CSS
>> and Javascript such that I could add CSS and JS just for those pages
>> that need it?
>>
>> Would it be something like this? Is this how you do it?
>>
>> <?
>> php require_once './css.php'; /* css.php contains
>> doctype, meta& css needed universally */
>> ?>
>>
>> <!-- link href= calls to CSS needed on local page only -->
>>
>> <?
>> php require_once './js.php'; /* js.php contains
>> javascript calls needed universally */
>> ?>
>>
>> <!-- script type="text/javascript" calls to Javascript needed on
>> local page only -->
>> </head>
>
> As Jerry mentioned separate DOCTYPE from your CSS for starter. Mixing
> nonrelated things just leads to a clusterf*ck down the road. Keep it
> seperate/keep it clean. It's worth it in the long run.
>
> An easy way to pull this off is to put all your javascripts and css into
> a header type file like so (each CSS & JS seperately):
>
> if (@isset $javascript01){
> put code here
> }
>
> if (@isset $javascript02){
> put code here
> }
>
> if (@isset $css01){
> put code here
> }
> etc....
>
> On your pages include the header file. Then on the pages/files you need
> to use the $javascript01 & or $css01, just set the variable name you
> created in the header file:
>
> $javascript01 = 1
>
> Just that easy.
>
There are a number of reasons you wouldn't want to do it this way - but
all are off topic in a PHP newsgroups.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Luuk <Luuk@invalid.lan> |
|---|---|
| Date | 2011-10-09 20:03 +0200 |
| Message-ID | <4949m8-ole.ln1@luuk.invalid.lan> |
| In reply to | #3346 |
On 09-10-2011 19:52, Jerry Stuckle wrote:
> On 10/9/2011 9:46 AM, Mr. B-o-B wrote:
>> On 10/9/2011 1:51 AM, paris2venice cried from the depths of the abyss:
>>> I'm still a newbie at PHP. What would be the right way to include CSS
>>> and Javascript such that I could add CSS and JS just for those pages
>>> that need it?
>>>
>>> Would it be something like this? Is this how you do it?
>>>
>>> <?
>>> php require_once './css.php'; /* css.php contains
>>> doctype, meta& css needed universally */
>>> ?>
>>>
>>> <!-- link href= calls to CSS needed on local page only -->
>>>
>>> <?
>>> php require_once './js.php'; /* js.php contains
>>> javascript calls needed universally */
>>> ?>
>>>
>>> <!-- script type="text/javascript" calls to Javascript needed on
>>> local page only -->
>>> </head>
>>
>> As Jerry mentioned separate DOCTYPE from your CSS for starter. Mixing
>> nonrelated things just leads to a clusterf*ck down the road. Keep it
>> seperate/keep it clean. It's worth it in the long run.
>>
>> An easy way to pull this off is to put all your javascripts and css into
>> a header type file like so (each CSS & JS seperately):
>>
>> if (@isset $javascript01){
>> put code here
>> }
>>
>> if (@isset $javascript02){
>> put code here
>> }
>>
>> if (@isset $css01){
>> put code here
>> }
>> etc....
>>
>> On your pages include the header file. Then on the pages/files you need
>> to use the $javascript01 & or $css01, just set the variable name you
>> created in the header file:
>>
>> $javascript01 = 1
>>
>> Just that easy.
>>
>
> There are a number of reasons you wouldn't want to do it this way - but
> all are off topic in a PHP newsgroups.
>
If the reasons are about how to use PHP, they are ON topic, in a PHP
newsgroup. (not newsgroup*s*)
--
Luuk
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-09 15:08 -0400 |
| Message-ID | <j6srf3$ksm$1@dont-email.me> |
| In reply to | #3347 |
On 10/9/2011 2:03 PM, Luuk wrote:
> On 09-10-2011 19:52, Jerry Stuckle wrote:
>> On 10/9/2011 9:46 AM, Mr. B-o-B wrote:
>>> On 10/9/2011 1:51 AM, paris2venice cried from the depths of the abyss:
>>>> I'm still a newbie at PHP. What would be the right way to include CSS
>>>> and Javascript such that I could add CSS and JS just for those pages
>>>> that need it?
>>>>
>>>> Would it be something like this? Is this how you do it?
>>>>
>>>> <?
>>>> php require_once './css.php'; /* css.php contains
>>>> doctype, meta& css needed universally */
>>>> ?>
>>>>
>>>> <!-- link href= calls to CSS needed on local page only -->
>>>>
>>>> <?
>>>> php require_once './js.php'; /* js.php contains
>>>> javascript calls needed universally */
>>>> ?>
>>>>
>>>> <!-- script type="text/javascript" calls to Javascript needed on
>>>> local page only -->
>>>> </head>
>>>
>>> As Jerry mentioned separate DOCTYPE from your CSS for starter. Mixing
>>> nonrelated things just leads to a clusterf*ck down the road. Keep it
>>> seperate/keep it clean. It's worth it in the long run.
>>>
>>> An easy way to pull this off is to put all your javascripts and css into
>>> a header type file like so (each CSS & JS seperately):
>>>
>>> if (@isset $javascript01){
>>> put code here
>>> }
>>>
>>> if (@isset $javascript02){
>>> put code here
>>> }
>>>
>>> if (@isset $css01){
>>> put code here
>>> }
>>> etc....
>>>
>>> On your pages include the header file. Then on the pages/files you need
>>> to use the $javascript01 & or $css01, just set the variable name you
>>> created in the header file:
>>>
>>> $javascript01 = 1
>>>
>>> Just that easy.
>>>
>>
>> There are a number of reasons you wouldn't want to do it this way - but
>> all are off topic in a PHP newsgroups.
>>
>
> If the reasons are about how to use PHP, they are ON topic, in a PHP
> newsgroup. (not newsgroup*s*)
>
The reasons have nothing to do with PHP - which is why I said they are
off topic. An HTML, CSS and/or Javascript newsgroups would be much better.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Michael Joel <no@please.com> |
|---|---|
| Date | 2011-10-09 16:31 -0400 |
| Message-ID | <qf0497lcimr000ah7nr9cnvjn7aurkdof1@4ax.com> |
| In reply to | #3340 |
On Sat, 8 Oct 2011 23:51:10 -0700 (PDT), paris2venice
<paris2venice@gmail.com> wrote:
>I'm still a newbie at PHP. What would be the right way to include CSS
>and Javascript such that I could add CSS and JS just for those pages
>that need it?
>
>Would it be something like this? Is this how you do it?
>
><?
> php require_once './css.php'; /* css.php contains
>doctype, meta & css needed universally */
>?>
>
><!-- link href= calls to CSS needed on local page only -->
>
><?
> php require_once './js.php'; /* js.php contains
>javascript calls needed universally */
>?>
>
><!-- script type="text/javascript" calls to Javascript needed on
>local page only -->
></head>
>
>
>Thanks a bunch for your help.
I think you are meaning you want to use PHP includes to drop in your
css and javascript. You can use the normal method combines with PHP or
just PHP...
Combined methode:
<link rel="stylesheet" type="text/css" href="GlobalCSS.css" />
<script type="text/javascript" src="GlobalJavascript.js"></script>
<?php
if($MYpageID="THIS IS THE PAGE I WANT IT ON") {
include("StylesForThisSpecialPage.php");
include("StylesForThisSpecialPage.php");
}
?>
The other method:
<?php
include("GlobalCSS.php");
include("Globalavascript.php");
if($MYpageID="THIS IS THE PAGE I WANT IT ON") {
include("StylesForThisSpecialPage.php");
include("SpecialJavascript.php");
}
?>
Of course the PHP files must be written just as they would be if they
were coded directly on the HTML page (not as if they are being
"linked").
Right or wrong? It works.
Mike
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-09 19:54 -0400 |
| Message-ID | <j6tc86$3oh$1@dont-email.me> |
| In reply to | #3351 |
On 10/9/2011 4:31 PM, Michael Joel wrote:
> On Sat, 8 Oct 2011 23:51:10 -0700 (PDT), paris2venice
> <paris2venice@gmail.com> wrote:
>
>> I'm still a newbie at PHP. What would be the right way to include CSS
>> and Javascript such that I could add CSS and JS just for those pages
>> that need it?
>>
>> Would it be something like this? Is this how you do it?
>>
>> <?
>> php require_once './css.php'; /* css.php contains
>> doctype, meta& css needed universally */
>> ?>
>>
>> <!-- link href= calls to CSS needed on local page only -->
>>
>> <?
>> php require_once './js.php'; /* js.php contains
>> javascript calls needed universally */
>> ?>
>>
>> <!-- script type="text/javascript" calls to Javascript needed on
>> local page only -->
>> </head>
>>
>>
>> Thanks a bunch for your help.
>
>
> I think you are meaning you want to use PHP includes to drop in your
> css and javascript. You can use the normal method combines with PHP or
> just PHP...
>
> Combined methode:
>
> <link rel="stylesheet" type="text/css" href="GlobalCSS.css" />
> <script type="text/javascript" src="GlobalJavascript.js"></script>
> <?php
>
> if($MYpageID="THIS IS THE PAGE I WANT IT ON") {
> include("StylesForThisSpecialPage.php");
> include("StylesForThisSpecialPage.php");
> }
> ?>
>
> The other method:
>
> <?php
> include("GlobalCSS.php");
> include("Globalavascript.php");
>
> if($MYpageID="THIS IS THE PAGE I WANT IT ON") {
> include("StylesForThisSpecialPage.php");
> include("SpecialJavascript.php");
> }
> ?>
>
> Of course the PHP files must be written just as they would be if they
> were coded directly on the HTML page (not as if they are being
> "linked").
> Right or wrong? It works.
>
> Mike
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):
CSS files should be CSS files - and should not have a .php extension;
there is almost never a need for any php code in a css file. The same
with javascript and .js extensions.
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.
There are a lot of things "that work" but are not a good idea.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-09 20:03 -0400 |
| Message-ID | <j6tco9$5nd$1@dont-email.me> |
| In reply to | #3352 |
On 10/9/2011 7:54 PM, Jerry Stuckle wrote: > > 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): > > CSS files should be CSS files - and should not have a .php extension; > there is almost never a need for any php code in a css file. The same > with javascript and .js extensions. > > 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. > > There are a lot of things "that work" but are not a good idea. > I should also add - unless the op has thousands of lines of javascript or css unused on a page, these attempts will actually decrease throughput. There is almost always more overhead in requesting another file (css or javascript) than there is just getting the file once and using it. This whole question sounds like premature optimization - which is very bad. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "Mr. B-o-B" <wtf.chuck@gmail.com> |
|---|---|
| Date | 2011-10-09 22:43 -0500 |
| Message-ID | <HUtkq.4097$%m.4010@newsfe05.iad> |
| In reply to | #3352 |
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.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-10 08:30 -0400 |
| Message-ID | <j6uogn$h4o$2@dont-email.me> |
| In reply to | #3354 |
On 10/9/2011 11:43 PM, Mr. B-o-B wrote:
> 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 spread crappy solutions like you continually provide? No, I'm here
to HELP people - not let them get your crappy advice.
>> 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.
>
>
To quote you:
----if (@isset $javascript01){
put code here
}
if (@isset $javascript02){
put code here
}
if (@isset $css01){
put code here
}
etc....
----
Crappy advice.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[toc] | [prev] | [next] | [standalone]
| From | Michael Joel <no@please.com> |
|---|---|
| Date | 2011-10-10 13:04 -0400 |
| Message-ID | <ld86971uaaek56n118p9grihh5deval8hn@4ax.com> |
| In reply to | #3362 |
On Mon, 10 Oct 2011 08:30:15 -0400, Jerry Stuckle <jstucklex@attglobal.net> wrote: >>............................... >> On 10/9/2011 6:54 PM, Jerry Stuckle cried from the depths of the abyss: I had a longer post but didn't want to say more than was needed... You seem to have a problem with manners. Sorry - I don't want to fight but it is usually better not to call people and their advice names. If you have better give it, let the OP decide. I use includes a lot. They work. They will work as long as your correct methods work. I use file names that make it clear what is in the files. Mike
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-10 13:44 -0400 |
| Message-ID | <j6vaum$l9k$2@dont-email.me> |
| In reply to | #3366 |
On 10/10/2011 1:04 PM, Michael Joel wrote: > On Mon, 10 Oct 2011 08:30:15 -0400, Jerry Stuckle > <jstucklex@attglobal.net> wrote: > >>> ............................... >>> On 10/9/2011 6:54 PM, Jerry Stuckle cried from the depths of the abyss: > > I had a longer post but didn't want to say more than was needed... > > You seem to have a problem with manners. Sorry - I don't want to fight > but it is usually better not to call people and their advice names. If > you have better give it, let the OP decide. > > I use includes a lot. > They work. They will work as long as your correct methods work. I use > file names that make it clear what is in the files. > > Mike You can also arm wrestle a polar bear. It's perfectly legal. But I wouldn't recommend it. There are a lot of things that "work". That doesn't mean they are good things to do - as I pointed out in my first reply to you. No, I don't have a problem with manners. I do have a problem with people who suggest crappy code. And BTW - I use includes a lot, also. But I use them correctly. -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "Mr. B-o-B" <wtf.chuck@gmail.com> |
|---|---|
| Date | 2011-10-10 21:35 -0500 |
| Message-ID | <J_Nkq.2956$ma7.1421@newsfe19.iad> |
| In reply to | #3369 |
On 10/10/2011 12:44 PM, Jerry Stuckle cried from the depths of the abyss: > > There are a lot of things that "work". That doesn't mean they are good > things to do - as I pointed out in my first reply to you. You haven't actually pointed out anything. Forgot your med's again? > > No, I don't have a problem with manners. I do have a problem with people > who suggest crappy code. Unless you consider this useful.
[toc] | [prev] | [next] | [standalone]
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Date | 2011-10-10 23:04 -0400 |
| Message-ID | <j70bo7$b1q$1@dont-email.me> |
| In reply to | #3374 |
On 10/10/2011 10:35 PM, Mr. B-o-B wrote: > On 10/10/2011 12:44 PM, Jerry Stuckle cried from the depths of the abyss: > >> >> There are a lot of things that "work". That doesn't mean they are good >> things to do - as I pointed out in my first reply to you. > > You haven't actually pointed out anything. Forgot your med's again? > I pointed out several things wrong with your crappy code. But I know you can't read, much less write. >> >> No, I don't have a problem with manners. I do have a problem with people >> who suggest crappy code. > > Unless you consider this useful. I surely don't consider YOU useful. You're just a run-of-the-mill troll. BTW - you know all about meds, don't you? Been on them all your life? -- ================== Remove the "x" from my email address Jerry Stuckle JDS Computer Training Corp. jstucklex@attglobal.net ==================
[toc] | [prev] | [next] | [standalone]
| From | "Mr. B-o-B" <wtf.chuck@gmail.com> |
|---|---|
| Date | 2011-10-10 22:14 -0500 |
| Message-ID | <RyOkq.4249$%m.1042@newsfe05.iad> |
| In reply to | #3376 |
On 10/10/2011 10:04 PM, Jerry Stuckle cried from the depths of the abyss: > On 10/10/2011 10:35 PM, Mr. B-o-B wrote: >> On 10/10/2011 12:44 PM, Jerry Stuckle cried from the depths of the abyss: >> >>> >>> There are a lot of things that "work". That doesn't mean they are good >>> things to do - as I pointed out in my first reply to you. >> >> You haven't actually pointed out anything. Forgot your med's again? >> > > I pointed out several things wrong with your crappy code. But I know you > can't read, much less write. > Again, no you didn't. Take your med's little Jerry, and go to bed. >>> >>> No, I don't have a problem with manners. I do have a problem with people >>> who suggest crappy code. >> >> Unless you consider this useful. > > I surely don't consider YOU useful. You're just a run-of-the-mill troll. Pot. Kettle. Black. > > BTW - you know all about meds, don't you? Been on them all your life? >
[toc] | [prev] | [next] | [standalone]
| From | Michael Joel <no@please.com> |
|---|---|
| Date | 2011-10-10 23:24 -0400 |
| Message-ID | <7ld797hlc5o8rjten9lq12r03h4orfu0b6@4ax.com> |
| In reply to | #3378 |
On Mon, 10 Oct 2011 22:14:10 -0500, "Mr. B-o-B" <wtf.chuck@gmail.com> wrote: >On 10/10/2011 10:04 PM, Jerry Stuckle cried from the depths of the abyss: >> On 10/10/2011 10:35 PM, Mr. B-o-B wrote: >> I REALLY hope you both are very very young?
[toc] | [prev] | [next] | [standalone]
| From | Tim Streater <timstreater@greenbee.net> |
|---|---|
| Date | 2011-10-11 10:33 +0100 |
| Message-ID | <timstreater-580A16.10334711102011@news.individual.net> |
| In reply to | #3378 |
In article <RyOkq.4249$%m.1042@newsfe05.iad>, "Mr. B-o-B" <wtf.chuck@gmail.com> wrote: > On 10/10/2011 10:04 PM, Jerry Stuckle cried from the depths of the abyss: > > On 10/10/2011 10:35 PM, Mr. B-o-B wrote: > >> On 10/10/2011 12:44 PM, Jerry Stuckle cried from the depths of the abyss: > >> > >>> > >>> There are a lot of things that "work". That doesn't mean they are good > >>> things to do - as I pointed out in my first reply to you. > >> > >> You haven't actually pointed out anything. Forgot your med's again? > >> > > > > I pointed out several things wrong with your crappy code. But I know you > > can't read, much less write. > > > > Again, no you didn't. Take your med's little Jerry, and go to bed. Take his med's *what*? His med doesn't have a little Jerry - so what are you *talking* about? -- Tim "That excessive bail ought not to be required, nor excessive fines imposed, nor cruel and unusual punishments inflicted" -- Bill of Rights 1689
[toc] | [prev] | [next] | [standalone]
Page 1 of 2 [1] 2 Next page →
Back to top | Article view | comp.lang.php
csiph-web