Skip to content
linzongshu edited this page Aug 5, 2012 · 9 revisions

Theme View Helper

Contents

asset assetModule

  • :ref:assetTheme
  • :ref:basePath
  • :ref:baseUrl
  • :ref:blocks
  • :ref:css
  • :ref:doctype
  • :ref:headLink
  • :ref:headMeta
  • :ref:headScript
  • :ref:headTitle
  • :ref:I18nTheme
  • :ref:jQuery
  • :ref:js
  • :ref:meta
  • :ref:navigation
  • :ref:template
  • :ref:templateModule
  • :ref:templateTheme
  • :ref:url

.. _asset:

asset

asset -- getting URI of an asset.

Description

Object asset(string $component , string $file)

Parameters

component

Component including asset file, such as theme/default, module/demo.

file

File name to build asset URI.

Example

::

$this->asset('theme/default', 'css/style.css'); $this->asset('module/demo', 'js/demo.js');

.. _assetModule:

assetModule

assetModule -- building module asset URI.

Description

string assetModule(string $file, string $module = null)

Parameters

file

File name for building module asset URI.

module

Module name.

Example

::

$this->assetModule('css/style.css'); $this->assetModule('css/style.css', 'demo');

.. _assetTheme:

assetTheme

assetTheme -- building theme asset URI.

Description

string assetTheme(string $file, string $theme = null)

Parameters

file

File name for building theme asset URI.

module

Theme name.

Example

::

$this->assetTheme('css/style.css'); $this->assetTheme('css/style.css', 'default');

.. _basePath:

basePath

basePath -- building a base path.

Description

string basePath(string $file)

Parameters

file

File name for building base path.

Example

::

$this->basePath('index.php'); $this->basePath('asset');

.. _baseUrl:

baseUrl

baseUrl -- returning site's base path of file with base path prepended.

Description

Object baseUrl(string $file = null)

Parameters

file

File name to generate URL.

Example

::

$this->baseUrl();

.. _blocks:

blocks

blocks -- loading blocks of a specified zone.

Description

array|Blocks blocks(string $zone)

Parameters

zone

Zone to load blocks.

Example

::

$this->blocks();

.. _css:

css

css -- loading CSS files.

Description

Object css(string|array $file)

Parameters

file

File name of CSS file or array include file name of CSS files.

Example

::

$this->css('file.css'); $this->css(array('file1.js', 'file2.js'));

.. _doctype:

doctype

doctype -- creating a doctype of HTML and XHTML document.

Description

Object doctype(string $doctype)

Parameters

doctype

The doctype allows you to specify one of the following types:

XHTML11

XHTML1_STRICT

XHTML1_TRANSITIONAL

XHTML1_FRAMESET

XHTML1_RDFA

XHTML_BASIC1

HTML4_STRICT

HTML4_LOOSE

HTML4_FRAMESET

HTML5

Example

::

$this->doctype('XHTML1_STRICT');

.. _headLink:

headLink

headLink -- creating and aggregating HTML element for later retrieval and output in your layout script.

Description

Object headLink(array $attributes = null, $placement = Placeholder\Container\AbstractContainer::APPEND)

Parameters

attributes

Attributes to create link.

Example

::

$this->headLink(); $this->headLink(array( 'rel' => 'icon', 'href' => '/img/favicon.ico'), 'PREPEND');

.. _headMeta:

headMeta

headMeta -- creating HTML element for later retrieval and output.

Description

Object headMeta(string $content = null, string $keyValue = null, string $keyType = 'name', array $modifiers = array(), string $placement = Placeholder\Container\AbstractContainer::APPEND)

Parameters

content

Content of meta.

keyValue

Content for the key specified in $keyType.

keyType

May be specified as 'property' if the doctype has been set to XHTML1_RDFA.

placement

Can be 'SET', 'APPEND' or 'PREPEND'.

Example

::

$this->headMeta(); $this->headMeta()->appendName('keywords', 'framework, PHP, productivity');

.. _headScript:

headScript

headScript -- creating HTML <script> element for later retrieval and output.

Description

Object headScript(string $mode = HeadScript::FILE, string $spec = null, string $placement = 'APPEND', array $attrs = array(), string $type = 'text/javascript')

Parameters

mode

May be specified as FILE or SCRIPT.

spec

Url of script.

placement

Can be 'SET', 'APPEND' or 'PREPEND'.

attrs

Attributes of script.

type

Type of script or array of script attributes.

Example

::

$this->headScript()->appendFile('/js/scriptaculous.js');

.. _headTitle:

headTitle

headTitle -- creating and storing a HTML <title> element for later retrieval and output programmatically.

Description

Object headTitle(string $title = null, string $setType = null)

Parameters

title

Name of title.

setType

Type of title, the value can be APPEND, PREPEND or SET.

Example

::

$this->headTitle(); $this->headTitle('Zend Framework');

.. _I18nTheme:

I18nTheme

I18nTheme -- loading a theme i18n resource.

Description

Object I18nTheme(string $domain, string $theme = null, string $locale = null)

Parameters

domain

theme

Theme name to use.

locale

Language name to use.

Example

::

$this->i18nTheme('main'); $this->i18nTheme('main', 'default'); $this->jQuery('main', null, 'en');

.. _jQuery:

jQuery

jQuery -- loading jQuery files or css files, if there is no parameter assigned, it will load 'jquery.min.js' file as default.

Description

void jQuery(string|array $filename)

Parameters

filename

Name of jQuery file want to load.

Example

::

$this->jQuery(); $this->jQuery('extension.js'); $this->jQuery(array('example.js', 'jQuery.min.js'));

.. _js:

js

js -- loading JavaScript files.

Description

Object js(string|array $file)

Parameters

file

File name of JavaScript file or array include file name of CSS files.

Example

::

$this->js('file.js'); $this->js(array('file1.js', 'file2.js'));

.. _meta:

meta

meta -- getting meta data from configuration.

Description

string|Meta meta(string $name)

Parameters

name

Field name of meta array.

Example

::

$this->meta('title');

.. _navigation:

navigation

navigation -- used for rendering navigational elements from Zend\Navigation\AbstractContainer instances.

Description

Object navigation(string|AbstractContainer $container = null)

Parameters

container

Container to operate on.

Example

::

$this->navigation()->breadcrumbs(); $this->navigation()->links(); $this->navigation()->menu(); // rendering menus from navigation containers

.. _template:

template

template -- setting template to use.

Description

string template(string $template)

Parameters

template

Template name.

Example

::

$this->template('login');

.. _templateModule:

templateModule

templateModule -- getting full path to a module template.

Description

string templateModule(string $template, string $module = null)

Parameters

template

Template name.

module

Module name.

Example

::

$this->template('admin/public_index.phtml', 'demo');

.. _templateTheme:

templateTheme

templateTheme -- getting full path to a theme template.

Description

string templateTheme(string $template)

Parameters

template

Template name.

Example

::

$this->template('header.phtml');

.. _url:

url

url -- generating an url by given name and route .

Description

Object url(string $name = null, array $params = array(), array $options = array() boolean $reuseMatchedParams = false)

Parameters

name

Name of the route.

params

Parameters for generating url.

options

Options for the route.

attrs

Attributes of script.

reuseMatchedParams

Whether to reuse matched parameters.

Example

::

$this->url(' ', array('controller' => 'index' 'action' => 'index'));

Clone this wiki locally