Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #12160 > unrolled thread
| Started by | richard <noreply@example.com> |
|---|---|
| First post | 2013-12-06 12:05 -0500 |
| Last post | 2013-12-20 18:57 +0100 |
| Articles | 13 — 12 participants |
Back to article view | Back to comp.lang.php
when incuding a page richard <noreply@example.com> - 2013-12-06 12:05 -0500
Re: when incuding a page "J.O. Aho" <user@example.net> - 2013-12-06 18:16 +0100
Re: when incuding a page Dennis <nobody@nowhere.invalid> - 2013-12-06 12:29 -0500
Re: when incuding a page "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> - 2013-12-06 18:09 +0000
Re: when incuding a page The Natural Philosopher <tnp@invalid.invalid> - 2013-12-06 19:33 +0000
Re: when incuding a page Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-06 20:44 +0100
Re: when incuding a page Richard Yates <richard@yatesguitar.com> - 2013-12-06 12:15 -0800
Re: when incuding a page Scott Johnson <noonehome@chalupasworld.com> - 2013-12-06 13:35 -0800
Re: when incuding a page Fyndhorn Elder <bubble@caradhras.lan> - 2013-12-15 17:42 +0000
Re: when incuding a page Christoph Michael Becker <cmbecker69@arcor.de> - 2013-12-15 19:34 +0100
Re: when incuding a page Moon Elf <moonelf@moonelfsystem.net> - 2013-12-15 19:34 +0000
Re: when incuding a page Ben Bacarisse <ben.usenet@bsb.me.uk> - 2013-12-15 21:10 +0000
Re: when incuding a page Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-12-20 18:57 +0100
| From | richard <noreply@example.com> |
|---|---|
| Date | 2013-12-06 12:05 -0500 |
| Subject | when incuding a page |
| Message-ID | <1uhcw9wjxnuap$.oya5fj4d12fv.dlg@40tude.net> |
<?php inlcude "page.html" ?> Should the include page be a complete page with headers or not? The validator throws a hissy fit when doing so. If not, then how does one properly include the stuff for that page? Such as CSS or javascript.
[toc] | [next] | [standalone]
| From | "J.O. Aho" <user@example.net> |
|---|---|
| Date | 2013-12-06 18:16 +0100 |
| Message-ID | <bgef3uF20ioU1@mid.individual.net> |
| In reply to | #12160 |
On 06/12/13 18:05, richard wrote: > <?php inlcude "page.html" ?> > > Should the include page be a complete page with headers or not? Depends on how you have written things. > The validator throws a hissy fit when doing so. Then you didn't write things properly. > If not, then how does one properly include the stuff for that page? > Such as CSS or javascript. As you would for a normal html page. -- //Aho
[toc] | [prev] | [next] | [standalone]
| From | Dennis <nobody@nowhere.invalid> |
|---|---|
| Date | 2013-12-06 12:29 -0500 |
| Message-ID | <q824a95pqctc4f9a0imrvklht3omeqg8ek@4ax.com> |
| In reply to | #12161 |
On 06/12/13 18:05, RtS wrote: > <?php inlcude "page.html" ?> And it would help if you spelled "include" correctly. -- Dennis
[toc] | [prev] | [next] | [standalone]
| From | "Beauregard T. Shagnasty" <a.nony.mous@example.invalid> |
|---|---|
| Date | 2013-12-06 18:09 +0000 |
| Message-ID | <l7t3t4$lkr$1@dont-email.me> |
| In reply to | #12160 |
richard the sto0pid wrote: > <?php inlcude "page.html" ?> Maybe if you speeled it correctly. > Should the include page be a complete page with headers or not? The correct answer is: it depends. > The validator throws a hissy fit when doing so. Then you've once again coded with errors. > If not, then how does one properly include the stuff for that page? > Such as CSS or javascript. It depends. Just think: if you were to pay someone from Bangladesh a couple hundred dollars, your site would be up and working by Monday. And *look* nice as well. -- -bts -This space for rent, but the price is high
[toc] | [prev] | [next] | [standalone]
| From | The Natural Philosopher <tnp@invalid.invalid> |
|---|---|
| Date | 2013-12-06 19:33 +0000 |
| Message-ID | <l7t8pe$mud$1@news.albasani.net> |
| In reply to | #12160 |
On 06/12/13 17:05, richard wrote: > <?php inlcude "page.html" ?> > ^^^^^^^ Computers prefer people who can spell correctly. and use the correct syntax... Your are not the PFY and you are pulling our legs -- Ineptocracy (in-ep-toc’-ra-cy) – a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2013-12-06 20:44 +0100 |
| Message-ID | <52a2290f$0$9503$9b4e6d93@newsspool1.arcor-online.net> |
| In reply to | #12160 |
richard wrote: > <?php inlcude "page.html" ?> > > Should the include page be a complete page with headers or not? > > The validator throws a hissy fit when doing so. > > If not, then how does one properly include the stuff for that page? > Such as CSS or javascript. Well, actually the include statement does not include a _page_, but rather the contents of a *file*. This basically works the same, as if the file contents were inserted instead of <?php include 'whatever'?>. If you have to include a "page" (i.e. an HTML document) stored in a file, you might be better off to display it as an IFRAME. -- Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Richard Yates <richard@yatesguitar.com> |
|---|---|
| Date | 2013-12-06 12:15 -0800 |
| Message-ID | <pmb4a9l2nhec3gpd49ff92oepr40gg6mv1@4ax.com> |
| In reply to | #12160 |
On Fri, 6 Dec 2013 12:05:46 -0500, richard <noreply@example.com> wrote: ><?php inlcude "page.html" ?> > >Should the include page be a complete page with headers or not? > >The validator throws a hissy fit when doing so. > >If not, then how does one properly include the stuff for that page? >Such as CSS or javascript. include inserts the contents of a file. That can be a whole html page or a fragment of code. Think of include as exactly the same as manually copy-and-pasting the contents of the file. So, for instance, if your page already has a <head> section before the include, then you probably do not want to have a <head> section in the included file. If you are including php code inside a section of php code, then you do not need <?php....?> in the included file. But if it is being inserted into the middle of html then you do need those. Again, just think of it as: include is just copy-and-pasting the contents of a file.
[toc] | [prev] | [next] | [standalone]
| From | Scott Johnson <noonehome@chalupasworld.com> |
|---|---|
| Date | 2013-12-06 13:35 -0800 |
| Message-ID | <l7tfvr$9tj$1@dont-email.me> |
| In reply to | #12160 |
On 12/6/2013 9:05 AM, richard wrote: > <?php inlcude "page.html" ?> > > Should the include page be a complete page with headers or not? > > The validator throws a hissy fit when doing so. > > If not, then how does one properly include the stuff for that page? > Such as CSS or javascript. > allow me to add that even though the ending semicolon is not needed for this particular line, YOU may want to put it there to minimize the error you come back here with when you add another line and forgot to add the semicolon. Scotty
[toc] | [prev] | [next] | [standalone]
| From | Fyndhorn Elder <bubble@caradhras.lan> |
|---|---|
| Date | 2013-12-15 17:42 +0000 |
| Message-ID | <m2situui2o.fsf@caradhras.lan> |
| In reply to | #12160 |
richard <noreply@example.com> writes:
> <?php inlcude "page.html" ?>
>
> Should the include page be a complete page with headers or not?
Look at the source code in your browser (right-click or CTRL-click on a mac mouse), select the view source menuitem. You'll see what is included on the output of your PHP script.
>
> The validator throws a hissy fit when doing so.
>
The correct syntax is include("string") or include('string literal')
> If not, then how does one properly include the stuff for that page?
> Such as CSS or javascript.
>
Again, watch the output in the source view of your browser.
HTH,
FE
--
Time heals.
My blog : https://thediaryofelvishhealer.blogger.com
[toc] | [prev] | [next] | [standalone]
| From | Christoph Michael Becker <cmbecker69@arcor.de> |
|---|---|
| Date | 2013-12-15 19:34 +0100 |
| Message-ID | <52adf632$0$6549$9b4e6d93@newsspool4.arcor-online.net> |
| In reply to | #12253 |
Fyndhorn Elder wrote:
> richard <noreply@example.com> writes:
>
>> <?php inlcude "page.html" ?>
>>
>> Should the include page be a complete page with headers or not?
>
> Look at the source code in your browser (right-click or CTRL-click on a mac mouse), select the view source menuitem. You'll see what is included on the output of your PHP script.
>
>>
>> The validator throws a hissy fit when doing so.
>>
>
> The correct syntax is include("string") or include('string literal')
include is not a function, but a statement, so the parentheses are not
required.
--
Christoph M. Becker
[toc] | [prev] | [next] | [standalone]
| From | Moon Elf <moonelf@moonelfsystem.net> |
|---|---|
| Date | 2013-12-15 19:34 +0000 |
| Message-ID | <slrnlas10u.nmd.moonelf@sigtrans.org> |
| In reply to | #12255 |
On 2013-12-15, Christoph Michael Becker <cmbecker69@arcor.de> wrote:
> Fyndhorn Elder wrote:
>
>> richard <noreply@example.com> writes:
>>
>>> <?php inlcude "page.html" ?>
>>>
>>> Should the include page be a complete page with headers or not?
>>
>> Look at the source code in your browser (right-click or CTRL-click on a mac
mouse), select the view source menuitem. You'll see what is included on the
output of your PHP script.
>>
>>>
>>> The validator throws a hissy fit when doing so.
>>>
>>
>> The correct syntax is include("string") or include('string literal')
>
> include is not a function, but a statement, so the parentheses are not
> required.
>
Indeed, you can write include "filename" or include 'filename' with a ; at the
end but your parser does not accept closures as in JS e.g. new.
ME
--
Member of the DR rogue circle.
Search and you will find.
[toc] | [prev] | [next] | [standalone]
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Date | 2013-12-15 21:10 +0000 |
| Message-ID | <0.e195285232cd2066f7d4.20131215211026GMT.87lhzlstvh.fsf@bsb.me.uk> |
| In reply to | #12257 |
Moon Elf <moonelf@moonelfsystem.net> writes:
> On 2013-12-15, Christoph Michael Becker <cmbecker69@arcor.de> wrote:
>> Fyndhorn Elder wrote:
>>
>>> richard <noreply@example.com> writes:
>>>
>>>> <?php inlcude "page.html" ?>
(It's been pointed out before, but there is a typo there: "incl" not
"inlc".)
>>>> Should the include page be a complete page with headers or not?
<snpi>
>>> The correct syntax is include("string") or include('string literal')
>>
>> include is not a function, but a statement, so the parentheses are not
>> required.
>
> Indeed, you can write include "filename" or include 'filename' with a
> ; at the end but your parser does not accept closures as in JS
> e.g. new.
What's the connection with closures?
--
Ben.
[toc] | [prev] | [next] | [standalone]
| From | Thomas 'PointedEars' Lahn <PointedEars@web.de> |
|---|---|
| Date | 2013-12-20 18:57 +0100 |
| Message-ID | <4742094.G5GMHY2kJp@PointedEars.de> |
| In reply to | #12255 |
Christoph Michael Becker wrote:
> Fyndhorn Elder wrote:
>> richard <noreply@example.com> writes:
>>> <?php inlcude "page.html" ?>
>> […]
>> The correct syntax is include("string") or include('string literal')
>
> include is not a function, but a statement, so the parentheses are not
> required.
The fascinating thing about “include” is that it works like a function
although it is a statement. If the include is successful, it returns 1 by
default, otherwise FALSE. And if the include is successful, and the
included PHP script contains a “return” statement, then the value of the
“return” statement's parameter (for lack of a better word) is the return
value of „include“ if execution reaches that statement.
However, in general it is considered good style to omit the parentheses.
It is considered even better style to avoid include* and require* when
possible, in favor of autoloading.
See also:
<http://php.net/include>
<http://pear.php.net/manual/en/standards.including.php>
<http://pear.php.net/manual/en/pear2cs.rules.php>
<http://php.net/autoload>
Unfortunately, so far the difference between function-like statements and
functions has never been made clear using different, but consistent code
style in the PHP manual.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.php
csiph-web