• Welcome to Simple Machines Community Forum. Please login or sign up.

obExit

Description

This is a very important function. It controls all the output - sending the header, loading the sub-template and sending the footer. It ends execution and remembers what the last URL you visited on the board was...

Syntax

void obExit ([mixed $do_header[, mixed $do_footer[, bool $from_index]]])



Parameter $do_header

Expected type: Mixed
Description: Whether or not to output the header (calls template_header() and starts output)

Allowed types for $do_header
Allowed values Description
Null (default value) - lets SMF decide what to do based on $header_done (see above)
Boolean Allows you to override automatic detection - true to send the headers even if they've already been sent and false to not send them even if they haven't been sent



Parameter $do_footer

Expected type: Mixed
Description: If true (or if the header has been sent), loads the sub-template specified by $context['sub_template'] and calls template_footer - this loads up the entire body and footer of the forum. If $context['sub_template'] isn't set, it defaults to 'main' (calling template_main() in the currently loaded template file)

Allowed types for $do_footer
Allowed values Description
Null (default value) - SMF will determine what to do based on whether or not the header was sent
Boolean Allows you to override automatic detection - true to load the subtemplate and footer even if the header hasn't been sent and false if you don't want to load the sub-template and footer (allows you to output only the header or nothing at all)



Parameter $from_index

Expected type: Boolean
Description: Only set to true if execution should return to index.php after the function is done (default is false); otherwise execution ends when the function ends


Notes

  • Kind of complicated...
  • Defines $header_done, a static variable that is set to false initially and is used to remember whether or not headers have been sent
  • Basically, you can either let SMF decide whether or not to send the header and footer, or you can specify whether each one should be sent...
Advertisement: