Class SSViewer
Parses a template file with an *.ss file extension.
In addition to a full template in the templates/ folder, a template in templates/Content or templates/Layout will be rendered into $Content and $Layout, respectively.
A single template can be parsed by multiple nested SSViewer instances
through $Layout/$Content placeholders, as well as <% include MyTemplateFile
%> template commands.
Themes
See http://doc.silverstripe.org/themes and http://doc.silverstripe.org/themes:developing
Caching
Compiled templates are cached via SS_Cache, usually on the
filesystem. If you put ?flush=all on your URL, it will force the template to be
recompiled.
Manifest File and Structure
Works with the global $_TEMPLATE_MANIFEST which is compiled by ManifestBuilder->getTemplateManifest(). This associative array lists all template filepaths by "identifier", meaning the name of the template without its path or extension.
Example:
array( 'LeftAndMain' => array ( 'main' => '/my/system/path/cms/templates/LeftAndMain.ss', ), 'CMSMain_left' => array ( 'Includes' => '/my/system/path/cms/templates/Includes/CMSMain_left.ss', ), 'Page' => array ( 'themes' => array ( 'blackcandy' => array ( 'Layout' => '/my/system/path/themes/blackcandy/templates/Layout/Page.ss', 'main' => '/my/system/path/themes/blackcandy/templates/Page.ss', ), 'blue' => array ( 'Layout' => '/my/system/path/themes/mysite/templates/Layout/Page.ss', 'main' => '/my/system/path/themes/mysite/templates/Page.ss', ), ), ), // ... )
Direct known subclasses
See: http://doc.silverstripe.org/themes
See: http://doc.silverstripe.org/themes:developing
Located at sapphire/core/SSViewer.php
Methods summary
public static
|
#
set_source_file_comments( boolean $val )
Set whether HTML comments indicating the source .SS file used to render this page should be included in the output. This is enabled by default |
public static
boolean
|
|
public static
|
|
public static
|
|
public static
string
|
|
public static
string
|
|
public
|
|
public static
|
|
public static
|
#
setOption( mixed $optionName, mixed $optionVal )
Set a global rendering option. The following options are available: |
public static
Mixed
|
|
public static
|
|
public
|
|
public
|
|
public static
string
|
#
getTemplateFile( string $identifier )
Searches for a template name in the current theme:
Falls back to unthemed template files. |
public static
string
|
|
public static
string
|
#
getTemplateContent( string $identifier )
Used by <% include Identifier %> statements to get the full unparsed content of a template file. |
public static
|
|
public
String
|
#
process(
The process() method handles the "meat" of the template processing. It takes
care of caching the output (via |
public static
|
|
public
|
|
public
|
|
public static
|
#
get_base_tag( mixed $contentGeneratedSoFar )
Return an appropriate base tag for the given template. It will be closed on an XHTML document, and unclosed on an HTML document. |
Magic methods summary
Properties summary
protected static
boolean
|
$source_file_comments |
#
$source_file_comments |
protected
boolean
|
$rewriteHashlinks | |
protected static
string
|
$current_theme | |
protected static
string
|
$current_custom_theme | |
protected static
array
|
$options | |
protected static
array
|
$topLevel |
Comments
Use the Silverstripe Forum to ask questions.