on-rev nomenclature

Jim Ault jimaultwins at yahoo.com
Thu Aug 27 15:00:27 EDT 2009


So what would be a good way to express this via on-rev?

in PHP scripting
     ECHO    or   PRINT    do the immediate send of a string to a  
browser when that line is executed...
unless you turn on Output Buffering
     ob_start()    -- Turn on output buffering

then later
      $stringToSend = ob_get_flush()
      -- Flush the output buffer, return it as a string and turn off  
output buffering

or, at the end of the script execution,
  the output buffer will automatically be sent to the browser .

The Output Control functions allow you to control when output is sent  
from the script. This can be useful in several different situations,  
especially if you need to send headers to the browser after your  
script has began outputting data. The Output Control functions only  
affect functions such as echo() and data between blocks of PHP code,  
and do not affect headers sent using header() or setcookie().
ob_start()     This function will turn output buffering on. While  
output buffering is active no output is sent from the script (other  
than headers), instead the output is stored in an internal buffer.
The contents of this internal buffer may be copied into a string  
variable using ob_get_contents().  To output what is stored in the  
internal buffer, use ob_end_flush(). Alternatively, ob_end_clean()  
will silently discard the buffer contents.



• Output Control Functions
	• flush — Flush the output buffer
	• ob_clean — Clean (erase) the output buffer
	• ob_end_clean — Clean (erase) the output buffer and turn off output  
buffering
	• ob_end_flush — Flush (send) the output buffer and turn off output  
buffering
	• ob_flush — Flush (send) the output buffer
	• ob_get_clean — Get current buffer contents and delete current  
output buffer
	• ob_get_contents — Return the contents of the output buffer
	• ob_get_flush — Flush the output buffer, return it as a string and  
turn off output buffering
	• ob_get_length — Return the length of the output buffer
	• ob_get_level — Return the nesting level of the output buffering  
mechanism
	• ob_get_status — Get status of output buffers
	• ob_gzhandler — ob_start callback function to gzip output buffer
	• ob_implicit_flush — Turn implicit flush on/off
	• ob_list_handlers — List all output handlers in use
	• ob_start — Turn on output buffering
	• output_add_rewrite_var — Add URL rewriter values
	• output_reset_rewrite_vars — Reset URL rewriter values




On Aug 27, 2009, at 11:03 AM, J. Landman Gay wrote:

> Richard Gaskin wrote:
>> The new server engine driving on-rev.com accounts lets us use "put"  
>> statements without specifying a container yet without returning the  
>> result until the script is finished.  This is useful, simpler than  
>> coding CGIs using the older method of putting into a variable since  
>> any unassigned put pushed the data back to the client in the old CGI.
>> Old school:
>> on startup
>> put GetInfoStuff() into tMyVar
>> put OtherStuff() after tMyVar
>> put HeaderInfo() & tMyVar -- outputs to client
>> end startup
>> New on-rev way:
>> on startup
>>  put GetInfoStuff() -- buffers internally
>>  put OtherStuff() -- more internal buffer
>> end startup -- finally goes out
>> So what does RR call this?  "Open puts"?
>
> You don't need the "on startup", you can drop lines of code in  
> "loose". If you do that, the "put" outputs immediately on execution:
>
> <?rev
> put GetInfoStuff() -- sent out immediately
> put OtherStuff() -- sent out next
> ?>
>
> If you do enclose statements inside handler calls, then I think they  
> do buffer until the handler ends (but I haven't tested enough.)
>
> And I don't know what you call those. :)
>
> -- 
> Jacqueline Landman Gay


Jim Ault
Las Vegas






More information about the Use-livecode mailing list