Front controller

class Nos\Controller_Front

Novius OS front-office controller

Use Nos::main_controller to retrieve its instance and call the methods.

Methods

Nos\Controller_Front::getContext()
Returns:The current context.
Nos\Controller_Front::getContextUrl()
Returns:Absolute URL of the current context.
Nos\Controller_Front::getPage()
Returns:Current Model_Page displayed.
Nos\Controller_Front::getWysiwygName()
Returns:Current wysiwyg ID processed.
Nos\Controller_Front::getUrl()
Returns:Current absolute URL.
Nos\Controller_Front::getPageUrl()
Returns:Relative (to Controller_Front::getContextUrl) URL of the current page.
Nos\Controller_Front::getEnhancedUrlPath()
Returns:
Relative (to Controller_Front::getContextUrl) URL of the current URL enhancer.
False if no current URL enhancer.

Same that Controller_Front::getPageUrl ending with / instead of .html.

Nos\Controller_Front::getEnhancerUrl()
Returns:
Part of the URL processed by the URL enhancer.
False if no current URL enhancer.
Nos\Controller_Front::getItemDisplayed()
Returns:The current item displayed.

New in version 4.1.

Nos\Controller_Front::setItemDisplayed(OrmModel $item, array $properties = array(), array $templates = array())
param Model $item:
 The current Model instance displayed.
param array $properties:
 Array of properties
param array $templates:
 Array of templates use to set properties

New in version 4.1: Set de current item displayed, by default this item is the page displayed, but can be call by an URL enhancer. This method set automatically title, h1, meta_description and meta_keywords for the current HTML.

Nos\Controller_Front::setBaseHref($base_href)
Parameters:
  • $base_href (string) – Sets a new <base href=""> for the current HTML output.
Nos\Controller_Front::setTitle($title, $template = null)
Parameters:
  • $title (string) – Set a new title for the current HTML.
  • $template (string) – If set, use it to calculate the title. Placeholders :title will be replaced by $title, :page_title will be replace by the curent page title.
Nos\Controller_Front::setH1($title, $template = null)
param string $title:
 Set a new H1 for the current HTML.
param string $template:
 If set, use it to calculate the H1. Placeholders :h1 will be replaced by $h1.

New in version 4.1.

Nos\Controller_Front::setMetaDescription($meta_description, $template = null)
Parameters:
  • $meta_description (string) – Set a meta description for the current HTML output.
  • $template (string) – If set, use it to calculate the meta_description. Placeholders :meta_description will be replaced by $meta_description, :page_meta_description will be replace by the curent page meta_description.
Nos\Controller_Front::setMetaKeywords($meta_keywords, $template = null)
Parameters:
  • $meta_keywords (string) – Set a meta keywords for the current HTML output.
  • $template (string) – If set, use it to calculate the meta_keywords. Placeholders :meta_keywords will be replaced by $meta_keywords, :page_meta_keywords will be replace by the curent page meta_keywords.
Nos\Controller_Front::setMetaRobots($meta_robots, $template = null)
Parameters:
  • $meta_robots (string) – Set a meta robots for the current HTML output.
  • $template (string) – If set, use it to calculate the meta_robots. Placeholders :meta_robots will be replaced by $meta_robots, :page_meta_robots will be replace by the curent page meta_robots.
Nos\Controller_Front::addMeta($meta)
Parameters:
  • $meta (string) – A HTML meta tag to add in the current HTML output.
Nos\Controller_Front::addJavascript($url, $footer = true)
Parameters:
  • $url (string) – URL of a JavaScript library to add in the current HTML output.
  • $footer (boolean) – If true, add script at the end of HTML output. If false, add in the <head>.
Nos\Controller_Front::addJavascriptInline($js, $footer = true)
Parameters:
  • $js (string) – Javascript code to add in the current HTML output.
  • $footer (boolean) – If true, add at the end of HTML output. If false, add in the <head>.
Nos\Controller_Front::addCss($url)
Parameters:
  • $url (string) – URL of a CSS file to add in the current HTML output.
Nos\Controller_Front::addCssInline($css)
Parameters:
  • $css (string) – CSS code to add in the current HTML output.
Nos\Controller_Front::isPreview()
Returns:Boolean, true if current page is requested in the preview mode.
Nos\Controller_Front::disableCaching()

Disable caching and cache retrieve of the current page.

Nos\Controller_Front::setCacheDuration($cache_duration)
Parameters:
  • $cache_duration (int) – Set a new cache duration of the current cache saving.
Nos\Controller_Front::setStatus($status)
Parameters:
  • $cache_duration (int) – Set a new response status of the current response. This status will be saved in cache.
Nos\Controller_Front::setHeader($name, $value, $replace = true)

Add or replace a header to current response. Headers will be saved in cache.

Parameters:
  • $name (string) – The header name
  • $value (string) – The header value
  • $replace (boolean) – Whether to replace existing value for the header, will never overwrite/be overwritten when false
Nos\Controller_Front::getCustomData($item, $default = null)

Returns a (dot notated) custom data of the current process.

Parameters:
  • $item (string) – Name of the custom data, can be dot notated.
  • $default (mixed) – The return value if the custom data isn’t found.
Returns:

The custom data or default if not found.

Nos\Controller_Front::setCustomData($item, $value, $cached = false)

Sets a (dot notated) custom data to the current process.

Parameters:
  • $item (string) – A (dot notated) custom data key
  • $value (mixed) – The custom data value
  • $cached (boolean) – If custom data have to be cached
Nos\Controller_Front::sendContent($content)

Replace the template by a specific content and stop treatments

Parameters:
  • $content (mixed) – The new content, can be a string or a View.
Nos\Controller_Front::addCacheSuffixHandler($handler)

Add a cache suffix handler for the current page

Parameters:
  • $handler (array) – The cache suffix handler
Returns:

The cache instance if the cache path have changed, null otherwise.

Read the Docs v: dubrovka
Versions
latest
elche
dubrovka
chiba.2
chiba.1
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.