API - XOOPS 2.5.11 Beta 2
By monxoops.fr
compiler.includeq.php File Reference

Namespaces

namespace  xos_opal
 

Functions

 smarty_compiler_includeq ($tag_args, &$comp)
 

Function Documentation

◆ smarty_compiler_includeq()

smarty_compiler_includeq (   $tag_args,
$comp 
)

Quick include template plug-in

Like foreachq, this plug-in has been written to provide a faster version of an already existing Smarty function. includeq can be used as a replacement for the Smarty include function as long as you are aware of the differences between them.

Normally, when you include a template, Smarty does the following:

  • Backup all your template variables in an array
  • Include the template you specified
  • Restore the template variables from the previously created backup array

The advantage of this method is that it makes the main template variables safe: if your main template uses a variable called $stuff and the included template modifies it value, the main template will recover the original value automatically.

While this can be useful in some cases (for example, when you include templates you have absolutely no control over), some may consider this a limitation and it has the disadvantage of slowing down the inclusion mechanism a lot.

includeq fixes that: the code it generates doesn't contain the variables backup/recovery mechanism and thus makes templates inclusion faster. Note that however, this new behavior may create problems in some cases (but you can prevent them most of the times, for example by always using a tmp_ prefix for the variables you create in included templates looping sections).

Parameters
$tag_args
$comp
Returns
string