phpDocumentor GalleryCore
Classes
[ class tree: GalleryCore ] [ index: GalleryCore ] [ all elements ]

Class: GalleryTemplate

Source Location: /modules/core/classes/GalleryTemplate.class

Class GalleryTemplate

Direct descendents
Child Class Description
MainTest_FakeTemplate Fake GalleryTemplate that doesn't actually fetch the data.
UnitTestTemplate Unit test GalleryTemplate. This is a fake GalleryTemplate that just serves as a container for template data to be used in GalleryView tests, free of dependencies to Smarty.

[ Top ]
Property Summary
string   $_compiledTemplateDir   A directory where the templates will be written into.
Smarty   $_smarty   The Smarty instance
string   $_templateDir   The directory containing our template files

[ Top ]
Method Summary
static string   preFilter()   Remove leading whitespace when compiling tpl to produce smaller html page sizes.
static boolean   shouldDoCompileCheck()   Check whether modification checks should be done to see if the compiled templates are still up to date. The result is cached in memory.
static string   _getActualTemplatePath()   Given a template name (foo/bar/path/file.tpl), return the active template path based on the
static Smarty   _getSmarty()   Return a properly configured instance of Smarty. This used to be a single shared static instance of Smarty, but now we build it every time we need it. Theoretically we shouldn't be creating more than one GalleryTemplate and hence, more than one Smarty instance per request. However, having it as a static object makes it less testable.
static array   _getThemeId()   Return the themeid for the current item.
GalleryTemplate   GalleryTemplate()  
GalleryStatus   display()   Display the properly localized template
array   fetch()   Render the properly localized template
mixed   getVariable()   Retrieve a template value
mixed   &getVariableByReference()   Retrieve a reference to a template value
boolean   hasVariable()   Return true if the given variable is set
void   head()   Add a template to include in the <head> section
void   javascript()   Add a JavaScript to include in the <head> section
void   link()   Add a <link> element in the <head> section
void   meta()   Add a meta element to the <head> section
void   resourceGetSecure()  
void   resourceGetTemplate()  
void   resourceGetTemplateBaseDir()   Returns the base directory of the specified template. This is required to support loading templates from g2data/plugins.
void   resourceGetTimestamp()  
void   resourceGetTrusted()  
void   setVariable()   Assign a template key/value pair
void   setVariableByReference()   Assign a template key/value pair
void   style()   Add a stylesheet to include in the <head> section
void   title()   Set the title to include in the <head> section
array   _initCompiledTemplateDir()   Initializes the directory where compiled templates will be saved for this specific template directory

[ Top ]
Properties
string   $_compiledTemplateDir [line 68]

A directory where the templates will be written into.

API Tags:
Access:  private


[ Top ]
Smarty   $_smarty [line 54]

The Smarty instance

API Tags:
Access:  private


[ Top ]
string   $_templateDir [line 61]

The directory containing our template files

API Tags:
Access:  private


[ Top ]
Methods
static method preFilter  [line 405]

  static string preFilter( string $source, mixed &$smarty  )

Remove leading whitespace when compiling tpl to produce smaller html page sizes.

Parameters:
string   $source:  tpl content

API Tags:
Return:  processed tpl content ready for compilation


[ Top ]
static method shouldDoCompileCheck  [line 380]

  static boolean shouldDoCompileCheck( )

Check whether modification checks should be done to see if the compiled templates are still up to date. The result is cached in memory.


API Tags:
Return:  false if the compiled templates should be used without any checking


[ Top ]
static method _getActualTemplatePath  [line 493]

  static string _getActualTemplatePath( string $templateName, &$smarty, Smarty $smarty  )

Given a template name (foo/bar/path/file.tpl), return the active template path based on the

following: if (module bar): /fullpath/themes/themeId/templates/bar_templateversion/path/local/file.tpl if (module bar): /fullpath/themes/themeId/templates/bar_templateversion/path/file.tpl /fullpath/foo/bar/path/local/file.tpl /fullpath/foo/bar/path/file.tpl

Parameters:
string   $templateName:  base template name
Smarty   $smarty: 
   &$smarty: 

API Tags:
Return:  path to the current active template file for the specified template name
Access:  private


[ Top ]
static method _getSmarty  [line 330]

  static Smarty _getSmarty( $trimWhitespace  )

Return a properly configured instance of Smarty. This used to be a single shared static instance of Smarty, but now we build it every time we need it. Theoretically we shouldn't be creating more than one GalleryTemplate and hence, more than one Smarty instance per request. However, having it as a static object makes it less testable.

Parameters:
   $trimWhitespace: 

API Tags:
Access:  private


Redefined in descendants as:

[ Top ]
static method _getThemeId  [line 564]

  static array _getThemeId( )

Return the themeid for the current item.


API Tags:
Return:  GalleryStatus a status code string ThemeId
Access:  private


[ Top ]
Constructor GalleryTemplate  [line 71]

  GalleryTemplate GalleryTemplate( $templateDir, [ $initSmarty = true], [ $trimWhitespace = true]  )

Parameters:
   $templateDir: 
   $initSmarty: 
   $trimWhitespace: 


[ Top ]
display  [line 241]

  GalleryStatus display( string $templateName  )

Display the properly localized template

Parameters:
string   $templateName: 

API Tags:
Return:  the status of the call


Redefined in descendants as:

[ Top ]
fetch  [line 219]

  array fetch( string $templateName  )

Render the properly localized template

Parameters:
string   $templateName: 

API Tags:
Return:  GalleryStatus the status of the call string the HTML content


Redefined in descendants as:

[ Top ]
getVariable  [line 99]

  mixed getVariable( string $key  )

Retrieve a template value

Parameters:
string   $key: 

API Tags:
Return:  value


Redefined in descendants as:

[ Top ]
getVariableByReference  [line 110]

  mixed &getVariableByReference( string $key  )

Retrieve a reference to a template value

Parameters:
string   $key: 

API Tags:
Return:  value


Redefined in descendants as:

[ Top ]
hasVariable  [line 121]

  boolean hasVariable( string $key  )

Return true if the given variable is set

Parameters:
string   $key: 


Redefined in descendants as:

[ Top ]
head  [line 142]

  void head( string $tpl, [string $l10Domain = null]  )

Add a template to include in the <head> section

Parameters:
string   $tpl:  template path
string   $l10Domain:  (optional) localization domain default={1stdir}_{2nddir} from template path


Redefined in descendants as:

[ Top ]
javascript  [line 174]

  void javascript( string $path  )

Add a JavaScript to include in the <head> section

Parameters:
string   $path:  script path relative to gallery2 dir


[ Top ]
link  [line 183]

  void link( $attributes, string $path  )

Add a <link> element in the <head> section

Parameters:
string   $path:  script path relative to gallery2 dir
   $attributes: 


[ Top ]
meta  [line 206]

  void meta( unknown_type $name, unknown_type $content, [unknown_type $isHttpEquiv = false]  )

Add a meta element to the <head> section

Parameters:
unknown_type   $name:  Value for the name (or http-equiv) attribute
unknown_type   $content:  Value for the content attribute
unknown_type   $isHttpEquiv:  (optional) Whether this is a http-equiv element. Default false.


[ Top ]
resourceGetSecure  [line 606]

  void resourceGetSecure( $templateName, &$smarty  )

Parameters:
   $templateName: 
   &$smarty: 

API Tags:
See:  http://smarty.php.net/manual/en/template.resources.php


[ Top ]
resourceGetTemplate  [line 440]

  void resourceGetTemplate( $templateName, &$templateSource, &$smarty  )

Parameters:
   $templateName: 
   &$templateSource: 
   &$smarty: 

API Tags:
See:  function _getActualTemplatePath
See:  http://smarty.php.net/manual/en/template.resources.php This is basically the same as the file: resource except that we look for templates based on the search algorithm used by the _getActualTemplatePath method. This allows users and theme developers to override templates with our own copies without modifying the original.


[ Top ]
resourceGetTemplateBaseDir  [line 423]

  void resourceGetTemplateBaseDir( string $templateName, &$smarty, Smarty $smarty  )

Returns the base directory of the specified template. This is required to support loading templates from g2data/plugins.

This method was only used in resourceGetTemplate and resourceGetTimestamp to determine the base directory. That functionality is now handled in the _getActualTemplatePath method as part of the template override version checking, so is no longer required.

Parameters:
string   $templateName:  Template to get base directory for.
Smarty   $smarty: 
   &$smarty: 

API Tags:
Deprecated:  

Information Tags:
Author:  Jozef Selesi (selesi at gmail dot com)

[ Top ]
resourceGetTimestamp  [line 465]

  void resourceGetTimestamp( $templateName, &$templateTimestamp, &$smarty  )

Parameters:
   $templateName: 
   &$templateTimestamp: 
   &$smarty: 

API Tags:
See:  function _getActualTemplatePath
See:  http://smarty.php.net/manual/en/template.resources.php This is basically the same as the file: resource except that we look for templates based on the search algorithm used by the _getActualTemplatePath method. This allows users and theme developers to override templates with our own copies without modifying the original.


[ Top ]
resourceGetTrusted  [line 614]

  void resourceGetTrusted( $templateName, &$smarty  )

Parameters:
   $templateName: 
   &$smarty: 

API Tags:
See:  http://smarty.php.net/manual/en/template.resources.php


[ Top ]
setVariable  [line 89]

  void setVariable( string $key, [mixed $value = null]  )

Assign a template key/value pair

Parameters:
string   $key: 
mixed   $value: 


Redefined in descendants as:

[ Top ]
setVariableByReference  [line 132]

  void setVariableByReference( string $key, &$value, mixed $value  )

Assign a template key/value pair

Parameters:
string   $key: 
mixed   $value: 
   &$value: 


Redefined in descendants as:

[ Top ]
style  [line 164]

  void style( string $path  )

Add a stylesheet to include in the <head> section

Parameters:
string   $path:  stylesheet path relative to gallery2 dir


[ Top ]
title  [line 155]

  void title( string $title  )

Set the title to include in the <head> section

Parameters:
string   $title:  localized title


[ Top ]
_initCompiledTemplateDir  [line 267]

  array _initCompiledTemplateDir( )

Initializes the directory where compiled templates will be saved for this specific template directory

Each theme should have its own directory for compiled Smarty templates so that no name clashes occur. This subdirectory will be created on demand here.


API Tags:
Return:  GalleryStatus a status code string directory to use for complide templates


[ Top ]

Documentation generated on Fri, 08 Oct 2010 05:05:10 -0700 by phpDocumentor 1.3.0RC6