[pmwiki-users] Templates for new pages

Patrick R. Michaud pmichaud at pobox.com
Sun Mar 6 10:21:24 CST 2005


On Sun, Mar 06, 2005 at 05:00:49PM +0100, Knut Alboldt wrote:
> Patrick R. Michaud schrieb:
> >
> >    include_once('cookbook/edittemplates.php');
> >    $EditTemplates = '$Group.Template';
> 
> Just a short question to that (from a php-non-pro):
> 
> the include statement just includes the code and executes it, it doesn't
> function as a function call right ?
> So if I include edittemplate.php and want to browse or print a  page (so
> action is not "edit") where will the statement
> 	if ($action != 'edit') return;
> lead to ?

If "return" is executed while processing an included file, it stops
processing of the included file and returns control to the location
where the file was included.

> I assume this will simply abort my pmwiki-http-request.

To abort a request one would use exit().

The PHP documentation notes this on http://www.php.net/include/ :

     Handling Returns: It is possible to execute a return()  
     statement inside an included file in order to terminate 
     processing in that file and return to the script which 
     called it. Also, it's possible to return values from included files. 

Hope this helps,

Pm



More information about the pmwiki-users mailing list