class SSViewer_FromString extends SSViewer (View source)

Special SSViewer that will process a template passed as a string, rather than a filename.

Properties

static private bool $source_file_comments from  SSViewer
static private string $theme from  SSViewer
static private bool $theme_enabled from  SSViewer
$rewrite_hash_links from  SSViewer
static private bool $cache_template

The global template caching behaviour if no instance override is specified

Methods

static 
set_source_file_comments(bool $val) deprecated

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

from  SSViewer
static bool
get_source_file_comments() deprecated

No description

from  SSViewer
static 
flush()

Triggered early in the request when someone requests a flush.

from  SSViewer
static SSViewer
fromString(string $content, bool|void $cacheTemplate = null)

Create a template from a string instead of a .ss file

from  SSViewer
static 
set_theme(string $theme) deprecated

No description

from  SSViewer
static string
current_theme() deprecated

No description

from  SSViewer
static string
get_theme_folder()

Returns the path to the theme folder

from  SSViewer
static array
get_themes(string $path = null, bool $subthemes = false)

Returns an array of theme names present in a directory.

from  SSViewer
static string
current_custom_theme() deprecated

No description

from  SSViewer
static array
get_templates_by_class($className, $suffix = '', $baseClass = null)

Traverses the given the given class context looking for templates with the relevant name.

from  SSViewer
__construct($content, TemplateParser $parser = null)

No description

setParser(TemplateParser $parser)

Set the template parser that will be used in template generation

from  SSViewer
getParser()

Returns the parser that is set for template generation

from  SSViewer
static bool
hasTemplate(array $templates)

Returns true if at least one of the listed templates exists.

from  SSViewer
static 
setOption(string $optionName, mixed $optionVal) deprecated

Set a global rendering option.

from  SSViewer
static mixed
getOption($optionName) deprecated

No description

from  SSViewer
static 
topLevel()

No description

from  SSViewer
exists()

No description

from  SSViewer
static string
getTemplateFileByType(string $identifier, string $type)

No description

from  SSViewer
static 
flush_template_cache(bool $force = false)

Clears all parsed template files in the cache folder.

from  SSViewer
static 
flush_cacheblock_cache(bool $force = false)

Clears all partial cache blocks.

from  SSViewer
setPartialCacheStore(Zend_Cache_Core $cache)

Set the cache object to use when storing / retrieving partial cache blocks.

from  SSViewer
Zend_Cache_Core
getPartialCacheStore()

Get the cache object to use when storing / retrieving partial cache blocks.

from  SSViewer
includeRequirements($incl = true)

Flag whether to include the requirements in this response.

from  SSViewer
process(ViewableData $item, array|null $arguments = null, $scope = null)

The process() method handles the "meat" of the template processing.

static string
execute_template(string $template, mixed $data, array $arguments = null, $scope = null)

Execute the given template, passing it the given data.

from  SSViewer
static string
execute_string(string $content, mixed $data, array $arguments = null)

Execute the evaluated string, passing it the given data.

from  SSViewer
parseTemplateContent($content, $template = "")

No description

from  SSViewer
templates()

Returns the filenames of the template that will be rendered. It is a map that may contain 'Content' & 'Layout', and will have to contain 'main'

from  SSViewer
setTemplateFile(string $type, string $file)

No description

from  SSViewer
static 
get_base_tag($contentGeneratedSoFar)

Return an appropriate base tag for the given template.

from  SSViewer
setCacheTemplate(bool $cacheTemplate)

No description

bool
getCacheTemplate()

No description

Details

static set_source_file_comments(bool $val) deprecated

deprecated 4.0 Use the "SSViewer.source_file_comments" config setting instead

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

Parameters

bool $val

static bool get_source_file_comments() deprecated

deprecated 4.0 Use the "SSViewer.source_file_comments" config setting instead

Return Value

bool

static flush()

Triggered early in the request when someone requests a flush.

static SSViewer fromString(string $content, bool|void $cacheTemplate = null)

Create a template from a string instead of a .ss file

Parameters

string $content

The template content

bool|void $cacheTemplate

Whether or not to cache the template from string

Return Value

SSViewer

static set_theme(string $theme) deprecated

deprecated 4.0 Use the "SSViewer.theme" config setting instead

Parameters

string $theme

The "base theme" name (without underscores).

static string current_theme() deprecated

deprecated 4.0 Use the "SSViewer.theme" config setting instead

Return Value

string

static string get_theme_folder()

Returns the path to the theme folder

Return Value

string

static array get_themes(string $path = null, bool $subthemes = false)

Returns an array of theme names present in a directory.

Parameters

string $path
bool $subthemes

Include subthemes (default false).

Return Value

array

static string current_custom_theme() deprecated

deprecated since version 4.0

Return Value

string

static array get_templates_by_class($className, $suffix = '', $baseClass = null)

Traverses the given the given class context looking for templates with the relevant name.

Parameters

$className

string - valid class name

$suffix

string

$baseClass

string

Return Value

array

__construct($content, TemplateParser $parser = null)

Parameters

$content
TemplateParser $parser

setParser(TemplateParser $parser)

Set the template parser that will be used in template generation

Parameters

TemplateParser $parser

TemplateParser getParser()

Returns the parser that is set for template generation

Return Value

TemplateParser

static bool hasTemplate(array $templates)

Returns true if at least one of the listed templates exists.

Parameters

array $templates

Return Value

bool

static mixed getOption($optionName) deprecated

deprecated 4.0 Use the "SSViewer.rewrite_hash_links" config setting instead

Parameters

$optionName

Return Value

mixed

static topLevel()

static string getTemplateFileByType(string $identifier, string $type)

Parameters

string $identifier

A template name without '.ss' extension or path

string $type

The template type, either "main", "Includes" or "Layout"

Return Value

string

Full system path to a template file

static flush_template_cache(bool $force = false)

Clears all parsed template files in the cache folder.

Can only be called once per request (there may be multiple SSViewer instances).

Parameters

bool $force

Set this to true to force a re-flush. If left to false, flushing may only be performed once a request.

static flush_cacheblock_cache(bool $force = false)

Clears all partial cache blocks.

Can only be called once per request (there may be multiple SSViewer instances).

Parameters

bool $force

Set this to true to force a re-flush. If left to false, flushing may only be performed once a request.

setPartialCacheStore(Zend_Cache_Core $cache)

Set the cache object to use when storing / retrieving partial cache blocks.

Parameters

Zend_Cache_Core $cache

Zend_Cache_Core getPartialCacheStore()

Get the cache object to use when storing / retrieving partial cache blocks.

Return Value

Zend_Cache_Core

includeRequirements($incl = true)

Flag whether to include the requirements in this response.

Parameters

$incl

HTMLText process(ViewableData $item, array|null $arguments = null, $scope = null)

The process() method handles the "meat" of the template processing.

It takes care of caching the output (via {@link SS_Cache}), as well as replacing the special "$Content" and "$Layout" placeholders with their respective subtemplates.

The method injects extra HTML in the header via {@link Requirements::includeInHTML()}.

Note: You can call this method indirectly by {@link ViewableData->renderWith()}.

Parameters

ViewableData $item
array|null $arguments
  • arguments to an included template
$scope

Return Value

HTMLText

Parsed template output.

static string execute_template(string $template, mixed $data, array $arguments = null, $scope = null)

Execute the given template, passing it the given data.

Used by the <% include %> template tag to process templates.

Parameters

string $template

Template name

mixed $data

Data context

array $arguments

Additional arguments

$scope

Return Value

string

Evaluated result

static string execute_string(string $content, mixed $data, array $arguments = null)

Execute the evaluated string, passing it the given data.

Used by partial caching to evaluate custom cache keys expressed using template expressions

Parameters

string $content

Input string

mixed $data

Data context

array $arguments

Additional arguments

Return Value

string

Evaluated result

parseTemplateContent($content, $template = "")

Parameters

$content
$template

templates()

Returns the filenames of the template that will be rendered. It is a map that may contain 'Content' & 'Layout', and will have to contain 'main'

setTemplateFile(string $type, string $file)

Parameters

string $type

"Layout" or "main"

string $file

Full system path to the template file

static get_base_tag($contentGeneratedSoFar)

Return an appropriate base tag for the given template.

It will be closed on an XHTML document, and unclosed on an HTML document.

Parameters

$contentGeneratedSoFar

The content of the template generated so far; it should contain the DOCTYPE declaration.

setCacheTemplate(bool $cacheTemplate)

Parameters

bool $cacheTemplate

bool getCacheTemplate()

Return Value

bool