[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/template/ -> templateservice.class.php (sommaire)

default permissions used to create temporary template folders. Seems like Smarty creates them as 0771 but we have been adviced to create them as 775 as per this discussion: http://bugs.plogworld.net/view.php?id=253

Poids: 322 lignes (13 kb)
Inclus ou requis:0 fois
Référencé: 1 fois
Nécessite: 0 fichiers

Définit 1 class

TemplateService:: (9 méthodes):
  TemplateService()
  Template()
  customTemplate()
  AdminTemplate()
  CachedTemplate()
  _getTemplateFileInfo()
  PluginTemplate()
  PluginCachedTemplate()
  _configureTemplateSettings()


Classe: TemplateService  - X-Ref

\ingroup Template

Factory class that takes care of providing Template or CachedTemplate objects
whenever requested.

The advantage of using this TemplateService class is that we can delegate on it things
like finding the folder where the template is, choosing the right template depending
on the client type (normal browser, wap-enabled device, etc)

In order to find the most suitable template, it takes several things into account:

<ul>
<li>Settings stored for the current blog</li>
<li>User agent of the client</li> (<b>NOTE: </b>will not be implemented yet)
<li>The default template specified in the server-wide configuration file</li>
</ul>

TemplateService is the preferred way to generate instances of the Template class:

<pre>
$ts = new TemplateService();
// it's enough with "main", there is no need to specify "main.template" as the template name
$template = $ts->Template( "main", $blogInfo->getBlogTemplate(), $blogInfo );
$template->assign( "string", "This is a sample string" );
...
print($template->display());
</pre>
TemplateService()   X-Ref
Constructor


Template( $templateName, $layout, $blogInfo = null )   X-Ref
Generates a Template object for the given template name. This fuction does <b>not</b>
require the full path to the file!!

param: templateName The name of the template, it is not necessary to provide
param: layout A predefined layout style, which corresponds with the name of a
param: blogInfo If this parameter is not null, then it will be used to locate
return: A Template object representing the template file we asked for.

customTemplate( $templateName, $layout, $cached = false )   X-Ref
Returns a Template or CachedTemplate object pointing to a custom template.

param: templateName The name of the template, it is not necessary to provide
param: layout A predefined layout style, which corresponds with the name of a
param: cached Whether the custom template should be cached or not (this will affect
return: a Template or CachedTemplate object, depending on whether

AdminTemplate( $templateName, $blogInfo = null )   X-Ref
returns a template from the admin folder. It still uses TemplateService::Template but
exports additional information to the template such as the base template path so that
we can use {$admintemplatepath} from Smarty to get the right path, etc.

param: templateName The name of the template, it is not necessary to provide
param: blogInfo
return: A Template object pointing to a template from the templates/admin/ folder

CachedTemplate( $templateName, $layout, $blogInfo = null )   X-Ref
returns a CachedTemplate object, which works in exactly the same way as a Template
object but its contents will be cached as soon as they are generated. The lifetime
of cached contents is controlled via the 'template_cache_lifetime' configuration
parameter, but contents will be regenerated automatically as soon as
CacheControll::resetBlogCache() is called.

param: templateName The name of the template, it is not necessary to provide
param: layout A predefined layout style, which corresponds with the name of a
param: blogInfo
return: a CachedTemplate object pointing to the right .template file in disk

_getTemplateFileInfo( $templateName, $layout, $blogInfo )   X-Ref


PluginTemplate( $pluginId, $templateName, $blogInfo = null )   X-Ref
Returns a Template object loaded from a plugin template
Plugins are different in the sense that they store their templates in the
plugins/xxx/templates, where 'xxx' is the plugin identifier

param: pluginId The id of the plugin, which matches the name of a folder
param: templateName Name of the template, without the .template extension
param: blogInfo
return: a Template object

PluginCachedTemplate( $pluginId, $templateName, $blogInfo = null )   X-Ref
Returns a CachedTemplate object loaded from a plugin template
Plugins are different in the sense that they store their templates in the
plugins/xxx/templates, where 'xxx' is the plugin identifier

param: pluginId The id of the plugin, which matches the name of a folder
param: templateName Name of the template, without the .template extension
param: blogInfo
return: a CachedTemplate object

_configureTemplateSettings( $t, $blogInfo, $layout = "" )   X-Ref




Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics