× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



"By and far my favorite feature of PHP."

While I also use this feature in PHP, it is not unique to the language. It is just a good technique in writing HTML. It is a feature that spans many languages.

The challenge in web application design is to maximize code reuse and minimize the amount of "server markup" in an HTML template so that the web designers can do their thing while being blissfully ignorant, and not constrained by, the underlying server technology.

I know this thread is specific to PHP but I wanted to note that many languages support this feature.

Pete Helgren


Joel Cochran wrote:
On 10/3/07, Simon Cockayne <simon.cockayne@xxxxxxxxx> wrote:
Hi Larry, Jim, Joel,

*** In addition to echo you can also use: include, include_once, require
or
require_once, to bring in the contents of another file...which could
contain
straight HTML or code to produce HTML.

See http://devzone.zend.com/manual/function.require.html.


This is an excellent way to modularise your code...i.e. a change to the
included/required file is rippled throughout all files that
include/require
it, e.g:


By and far my favorite feature of PHP. All my websites are designed with
this modular approach. It allows me to have a single file for updating the
banner, another for the footer, another for the navigation, etc. etc. I can
change the entire site by updating a single file. Very handy. In fact, for
you to take advantage of reusable OO PHP code, this is necessary (I
recommend require_once for OO includes).

BUT: let's not confuse things and say it is a replacement for echo(),
because it isn't. They serve two distinct functions: echo outputs to
standard out (in PHP's case, this is back to the browser). All the include
functions do is bring the contents of another file into the current code,
kind of like a /copy in RPG. They bring them in at the exact placement of
the statement and they may or may not contain code that gets directly
outputted to the browser. As I mentioned above, they may simply include
class definitions or functions.

I just felt it was an important distinction.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.