On Mon, Nov 15, 1999 at 12:23:29PM -0800, Joshua Chamas wrote:
> Leslie Mikesell wrote:
> >
> > What I'm looking for is a 'nestable' way of handling the logic
> > flow and HTML construction that will allow a page to be used
> > as a stand-alone item (perhaps displayed in a frameset) or
> > included in another page, but when it is included I'd like to
> > have the option of letting its execution return a status
> > that the including page could see before it sends out any
> > HTML.
> > 
> 
> Apache::ASP scripts can be executed standalone or as
> sub scripts, with <!--#include file=...--> syntax.
> Embperl can do the same with its Execute() routine.
> 
> So, Apache::ASP nestable logic is like:
> 
> <% if($condition) { %>
>   <!--#include file=yes.inc args='yes'-->
> <% } else { %>
>   <!--#include file=no.inc args='no'-->
> <% } %>
> 
> In the case of Apache::ASP, you can bail out of a 
> subscript at anytime with $Response->End(), which will
> halt script execution as a special form of a die.
> 
> Apache::ASP furthermore buffers output by default, so
> you can kill the script at anytime with an error, and
> the user would not get half a script's output, just a 
> server error 500.
> 
> For more info check out:
> 
>   includes            http://www.nodeworks.com/asp/ssi.html
>   $Response->End()    http://www.nodeworks.com/asp/objects.html
>   BufferingOn config  http://www.nodeworks.com/asp/config.html#BufferingOn
> 

Another nice feature that Joshua didn't mention is that include files
can use variable arguments.  This allows you to encapsulate a
component of a page into what amounts to a function call.  The
DynamicIncludes option insures that each include runs inside it's own
function.

For example, you can pass a header include a background color variable
and a text color like this:


  $Response->Include('mypage.inc', 'black', 'white);


The SSI would then have this at the beginning:

my($bgcolor) = $_[0];
my($textcolor) = $_[1];



This is very, very useful.


-- 
Paul Lindner

Reply via email to