set-block

Summary

Renders all it's children as text and sets it as a template variable.

Usage

{set-block [name=value1] scope=[global|root|relative] variable=value2}
  ...tpl code
{/set-block}

Parameters

NameTypeDescriptionRequired
name string Name of namespace no
scope Scope of name yes
variable string Name of variable to return yes

Returns

Function will render the output of the block into the variable

Description

Renders all it's children as text and sets it as a template variable. This is useful for allowing
one template to return multiple text portions, for instance an email template could set subject as a
block and return the rest as body. Requires an end tag.

name
Defines the name of the namespace of the returned variable

scope
The scope parameter can be global, root or relative:

  • global - Sets the variable in the defined subspace (if any) in the global namespace
  • root - Sets the variable in the defined subspace in the root namespace of the current file
  • relative - Sets the variable in the defined subspace from the current namespace.

variable
Define the name of the variable to place the output into

Examples

example
This example will insert the output of the block into the variable 'text'

{set-block name=MyNameSpace scope=global variable=text}

 some content to insert into my variable 'text'

{/set-block}

output:<br/>

{$MyNameSpace:text

Comments

Log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
Template functions
    GUI
    Miscellaneous
    Program flow
    Variables
       append-block
       default
       let
       sequence
       set
       set-block
Data fetching
Modules
XML tags


Created

06/02/2004
2:23:59 pm
by Balazs Halasy

Last updated

09/11/2004
2:11:16 pm
by Gunnstein Lye

Authors

Balazs Halasy
Vidar Langseid
Gunnstein Lye



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.