API - XOOPS 2.5.11 Beta 2
By monxoops.fr
xos_opal_Theme Class Reference

Public Member Functions

 generateCacheId ($cache_id, $extraString='')
 
 checkCache ()
 
 render ($canvasTpl=null, $pageTpl=null, $contentTpl=null, $vars=array())
 
 loadLocalization ($type='main')
 
 addLanguage ($type='main', $language=null)
 
 addScript ($src='', $attributes=array(), $content='', $name='')
 
 addStylesheet ($src='', $attributes=array(), $content='', $name='')
 
 addLink ($rel, $href='', $attributes=array(), $name='')
 
 addHttpMeta ($name, $value=null)
 
 addMeta ($type='meta', $name='', $value='')
 
 headContent ($params, $content, &$smarty, &$repeat)
 
 renderMetas ($type=null, $return=false)
 
 genElementId ($tagName='xos')
 
 renderAttributes ($coll)
 
 resourcePath ($path)
 

Data Fields

 $renderBanner = true
 
 $folderName = ''
 
 $path = ''
 
 $url = ''
 
 $bufferOutput = true
 
 $canvasTemplate = 'theme.tpl'
 
 $themesPath = 'themes'
 
 $contentTemplate = ''
 
 $contentCacheLifetime = 0
 
 $contentCacheId
 
 $content = ''
 
 $plugins
 
 $renderCount = 0
 
 $template = false
 
 $metas
 
 $htmlHeadStrings = array()
 
 $templateVars = array()
 
 $use_extra_cache_id = true
 

Detailed Description

Member Function Documentation

◆ addHttpMeta()

addHttpMeta (   $name,
  $value = null 
)

Set a meta http-equiv value

Parameters
$name
null$value
Returns
string
Here is the call graph for this function:

◆ addLanguage()

addLanguage (   $type = 'main',
  $language = null 
)

Load theme specific language constants

Parameters
string$typelanguage type, like 'main', 'admin'; Needs to be declared in theme xo-info.php
string$languagespecific language
Returns
bool|mixed
Here is the caller graph for this function:

◆ addLink()

addLink (   $rel,
  $href = '',
  $attributes = array(),
  $name = '' 
)

Add a <link> to the header

Parameters
string$relRelationship from the current doc to the anchored one
string$hrefURI of the anchored document
array$attributesAdditional attributes to add to the <link> element
string$nameElement Name in array links are stored in.
Here is the call graph for this function:

◆ addMeta()

addMeta (   $type = 'meta',
  $name = '',
  $value = '' 
)

Change output page meta-information

Parameters
string$type
string$name
string$value
Returns
string
Here is the caller graph for this function:

◆ addScript()

addScript (   $src = '',
  $attributes = array(),
  $content = '',
  $name = '' 
)

*#+

@tasktype 20 Manipulating page meta-information Adds script code to the document head

This methods allows the insertion of an external script file (if $src is provided), or of a script snippet. The file URI is parsed to take benefit of the theme resource overloading system.

The $attributes parameter allows you to specify the attributes that will be added to the inserted <script> tag. If unspecified, the type attribute value will default to 'text/javascript'.

// Add an external script using a physical path $theme->addScript( 'www/script.js', null, '' ); $theme->addScript( 'modules/newbb/script.js', null, '' ); // Specify attributes for the <script> tag $theme->addScript( 'mod_xoops_SiteManager::common.js', array( 'type' => 'application/x-javascript' ), '', 'mod_xoops_Sitemanager' ); // Insert a code snippet $theme->addScript( null, array( 'type' => 'application/x-javascript' ), 'window.open("Hello world");', 'hello' );

Parameters
string$srcpath to an external script file
array$attributeshash of attributes to add to the <script> tag
string$contentCode snippet to output within the <script> tag
string$nameElement Name in array scripts are stored in.
Returns
void
Here is the call graph for this function:
Here is the caller graph for this function:

◆ addStylesheet()

addStylesheet (   $src = '',
  $attributes = array(),
  $content = '',
  $name = '' 
)

Add StyleSheet or CSS code to the document head

Parameters
string$srcpath to .css file
array$attributesname => value paired array of attributes such as title
string$contentCSS code to output between the <style> tags (in case $src is empty)
string$nameElement Name in array stylesheets are stored in.
Returns
void
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkCache()

checkCache ( )

xos_opal_Theme::checkCache()

Returns
bool
Here is the call graph for this function:

◆ genElementId()

genElementId (   $tagName = 'xos')

Generates a unique element ID

Parameters
string$tagName
Returns
string

◆ generateCacheId()

generateCacheId (   $cache_id,
  $extraString = '' 
)

Generate cache id based on extra information of language and user groups

User groups other than anonymous should be detected to avoid disclosing group sensitive contents

Parameters
string$cache_idraw cache id
string$extraStringextra string
Returns
string complete cache id
Here is the caller graph for this function:

◆ headContent()

headContent (   $params,
  $content,
$smarty,
$repeat 
)

xos_opal_Theme::headContent()

Parameters
mixed$params
mixed$content
mixed$smarty
mixed$repeat
Returns
void

◆ loadLocalization()

loadLocalization (   $type = 'main')

Load localization information

Folder structure for localization:

main.php - language definitions style.css - localization stylesheet script.js - localization script

Parameters
string$type
Returns
bool
Here is the call graph for this function:

◆ render()

render (   $canvasTpl = null,
  $pageTpl = null,
  $contentTpl = null,
  $vars = array() 
)

Render the page

The theme engine builds pages from 2 templates: canvas and content.

A module can call this method directly and specify what templates the theme engine must use. If render() hasn't been called before, the theme defaults will be used for the canvas and page template (and xoopsOption['template_main'] for the content).

Parameters
string$canvasTplThe canvas template, if different from the theme default
string$pageTplThe page template, if different from the theme default (unsupported, 2.3+ only)
string$contentTplThe content template
array$varsTemplate variables to send to the template engine
Returns
bool
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renderAttributes()

renderAttributes (   $coll)

Transform an attributes collection to an XML string

Parameters
array$coll
Returns
string
Here is the caller graph for this function:

◆ renderMetas()

renderMetas (   $type = null,
  $return = false 
)

xos_opal_Theme::renderMetas()

Parameters
mixed$type
mixed$return
Returns
bool|string
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resourcePath()

resourcePath (   $path)

Return a themeable file resource path

Parameters
string$path
Returns
string
Here is the caller graph for this function:

Field Documentation

◆ $bufferOutput

$bufferOutput = true

◆ $canvasTemplate

$canvasTemplate = 'theme.tpl'

◆ $content

$content = ''

◆ $contentCacheId

$contentCacheId

◆ $contentCacheLifetime

$contentCacheLifetime = 0

◆ $contentTemplate

$contentTemplate = ''

◆ $folderName

$folderName = ''

◆ $htmlHeadStrings

$htmlHeadStrings = array()

◆ $metas

$metas
Initial value:
= array(
'meta' => array(),
'link' => array(),
'script' => array())

◆ $path

$path = ''

◆ $plugins

$plugins
Initial value:
= array(
'xos_logos_PageBuilder')

◆ $renderBanner

$renderBanner = true

◆ $renderCount

$renderCount = 0

◆ $template

$template = false

◆ $templateVars

$templateVars = array()

◆ $themesPath

$themesPath = 'themes'

◆ $url

$url = ''

◆ $use_extra_cache_id

$use_extra_cache_id = true

The documentation for this class was generated from the following file: