when incuding a page [message #184111] |
Fri, 06 December 2013 17:05  |
Mr Oldies
Messages: 241 Registered: October 2013
Karma: 0
|
Senior Member |
|
|
<?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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: when incuding a page [message #184297 is a reply to message #184215] |
Fri, 20 December 2013 17:57  |
Thomas 'PointedEars'
Messages: 701 Registered: October 2010
Karma: 0
|
Senior Member |
|
|
Christoph Michael Becker wrote:
> Fyndhorn Elder wrote:
>> richard <noreply(at)example(dot)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
|
|
|