Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3361
| From | Jerry Stuckle <jstucklex@attglobal.net> |
|---|---|
| Newsgroups | comp.lang.php |
| Subject | Re: including CSS & JS on only pages that need that CSS & JS |
| Date | 2011-10-10 08:27 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <j6uocg$h4o$1@dont-email.me> (permalink) |
| References | <e3d8f6c1-a54c-436b-930e-44dd89997f12@v18g2000pri.googlegroups.com> <j6s4bs$ra8$1@dont-email.me> <b5300959-4417-40c1-9ce2-9903e7aed559@k25g2000prf.googlegroups.com> |
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
==================
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
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
csiph-web