a SENSIOLABS Product
Symfony

Templating
Simple yet powerful templating framework

sfTemplateEngine Class

All Classes

RELEASE INFORMATION

You are currently browsing the API for the trunk version.
sfTemplateEngine is the main class of the templating component.

METHODS
__construct()  constructor.
render()  renders a template.
setHelperSet()  sets a helper value.
getHelperSet()  gets all helper values.
__get()  gets a helper value.
extend()  decorates the current template with another one.
start()  starts a new slot.
stop()  stops a slot.
has()  returns true if the slot exists.
get()  gets the slot value.
set()  sets a slot value.
output()  outputs a slot.
escape()  escapes a string by using the current charset.
setCharset()  sets the charset to use.
getCharset()  gets the current charset.
  • __construct($loader, $renderers, $helperSet)

    Constructor.

    ARGUMENTS
    $loader A loader instance
    $renderers An array of renderer instances
    $helperSet A helper set instance
  • (string) render($name, $parameters)

    Renders a template.

    ARGUMENTS
    $name A template logical name
    $parameters An array of parameters to pass to the template

    returns The evaluated template as a string

    throws InvalidArgumentException if the renderer does not exist or if the template does not exist

  • setHelperSet($name, $value)

    Sets a helper value.

    ARGUMENTS
    $name The helper name
    $value The helper value
  • (array) getHelperSet()

    Gets all helper values.

    returns An array of all helper values

  • (mixed) __get($name)

    Gets a helper value.

    ARGUMENTS
    $name The helper name

    returns The helper value

    throws InvalidArgumentException if the helper is not defined

  • extend($template)

    Decorates the current template with another one.

    ARGUMENTS
    $template The decorator logical name
  • start($name)

    Starts a new slot.


    This method starts an output buffer that will be
    closed when the stop() method is called.

    ARGUMENTS
    $name The slot name

    throws InvalidArgumentException if a slot with the same name is already started

  • stop()

    Stops a slot.

    throws LogicException if no slot has been started

  • has($name)

    Returns true if the slot exists.

    ARGUMENTS
    $name The slot name
  • (string) get($name, $default)

    Gets the slot value.

    ARGUMENTS
    $name The slot name
    $default The default slot content

    returns The slot content

  • set($name, $content)

    Sets a slot value.

    ARGUMENTS
    $name The slot name
    $content The slot content
  • (Boolean) output($name, $default)

    Outputs a slot.

    ARGUMENTS
    $name The slot name
    $default The default slot content

    returns true if the slot is defined or if a default content has been provided, false otherwise

  • (string) escape($value)

    Escapes a string by using the current charset.

    ARGUMENTS
    $value A string to escape

    returns The escaped string or the original value if not a string

  • setCharset($charset)

    Sets the charset to use.

    ARGUMENTS
    $charset The charset
  • (string) getCharset()

    Gets the current charset.

    returns The current charset

powered by symfony - "symfony" is a trademark of Fabien Potencier, all rights reserved - The components "animals" are © 2009 Sensio Labs

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting.
Sensio Labs also supports several large Open-Source projects.