PHP Класс FOF30\Template\Template

С версии: 1.0
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$container FOF30\Container\Container The component container

Открытые методы

Метод Описание
__construct ( Container $container ) Public constructor
addCSS ( string $uri, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) : void Add a CSS file to the page generated by the CMS
addCSSInline ( string $css, string $type = 'text/css' ) Adds an inline stylesheet (inline CSS) to the page header
addJS ( string $uri, boolean $defer = false, boolean $async = false, string $version = null, string $type = 'text/javascript' ) : void Add a JS script file to the page generated by the CMS.
addJSInline ( string $script, string $type = 'text/javascript' ) Adds an inline JavaScript script to the page header
addLESS ( string $path, string $altPath = null, boolean $returnPath = false, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) : mixed Compile a LESS file into CSS and add it to the page generated by the CMS.
getAltPaths ( string $path ) : array Parse a fancy path definition into a path relative to the site's root.
loadModule ( string $moduleName, integer $style ) : string Render a module by name
loadPosition ( string $position, integer $style ) : string Returns the contents of a module position
parsePath ( string $path, boolean $localFile = false ) : string Parse a fancy path definition into a path relative to the site's root, respecting template overrides, suitable for inclusion of media files.
route ( string $route = '' ) : string Merges the current url with new or changed parameters.
sefSort ( string $text, string $field, stdClass $list ) : string Creates a SEF compatible sort header. Standard Joomla function will add a href="#" tag, so with SEF enabled, the browser will follow the fake link instead of processing the onSubmit event; so we need a fix.

Описание методов

__construct() публичный Метод

Public constructor
public __construct ( Container $container )
$container FOF30\Container\Container The component container

addCSS() публичный Метод

Add a CSS file to the page generated by the CMS
См. также: self::parsePath
public addCSS ( string $uri, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) : void
$uri string A path definition understood by parsePath, e.g. media://com_example/css/foo.css
$version string (optional) Version string to be added to the URL
$type string MIME type of the stylesheeet
$media string Media target definition of the style sheet, e.g. "screen"
$attribs array Array of attributes
Результат void

addCSSInline() публичный Метод

Adds an inline stylesheet (inline CSS) to the page header
public addCSSInline ( string $css, string $type = 'text/css' )
$css string The stylesheet content to add
$type string The MIME type of the script

addJS() публичный Метод

There are three combinations of defer and async (see http://www.w3schools.com/tags/att_script_defer.asp): * $defer false, $async true: The script is executed asynchronously with the rest of the page (the script will be executed while the page continues the parsing) * $defer true, $async false: The script is executed when the page has finished parsing. * $defer false, $async false. (default) The script is loaded and executed immediately. When it finishes loading the browser continues parsing the rest of the page. When you are using $defer = true there is no guarantee about the load order of the scripts. Whichever script loads first will be executed first. The order they appear on the page is completely irrelevant.
См. также: self::parsePath
public addJS ( string $uri, boolean $defer = false, boolean $async = false, string $version = null, string $type = 'text/javascript' ) : void
$uri string A path definition understood by parsePath, e.g. media://com_example/js/foo.js
$defer boolean Adds the defer attribute, see above
$async boolean Adds the async attribute, see above
$version string (optional) Version string to be added to the URL
$type string MIME type of the script
Результат void

addJSInline() публичный Метод

Adds an inline JavaScript script to the page header
public addJSInline ( string $script, string $type = 'text/javascript' )
$script string The script content to add
$type string The MIME type of the script

addLESS() публичный Метод

This method has integrated cache support. The compiled LESS files will be written to the media/lib_fof/compiled directory of your site. If the file cannot be written we will use the $altPath, if specified
См. также: self::parsePath
С версии: 2.0
public addLESS ( string $path, string $altPath = null, boolean $returnPath = false, string $version = null, string $type = 'text/css', string $media = null, array $attribs = [] ) : mixed
$path string A path definition understood by parsePath pointing to the source LESS file, e.g. media://com_example/less/foo.less
$altPath string A path definition understood by parsePath pointing to a precompiled CSS file, used when we can't write the generated file to the output directory, e.g. media://com_example/css/foo.css
$returnPath boolean Return the URL of the generated CSS file but do not include it. If it can't be generated, false is returned and the alt files are not included
$version string (optional) Version string to be added to the URL
$type string MIME type of the stylesheeet
$media string Media target definition of the style sheet, e.g. "screen"
$attribs array Array of attributes
Результат mixed True = successfully included generated CSS, False = the alternate CSS file was used, null = the source file does not exist

getAltPaths() публичный Метод

It returns both the normal and alternative (template media override) path. For example, media://com_foobar/css/test.css is parsed into array( 'normal' => 'media/com_foobar/css/test.css', 'alternate' => 'templates/mytemplate/media/com_foobar/css//test.css' ); The valid protocols are: media:// The media directory or a media override admin:// Path relative to administrator directory (no alternate) site:// Path relative to site's root (no alternate) auto:// Automatically guess if it should be site:// or admin:// plugin:// The plugin directory or a template override (must be plugin://pluginType/pluginName/templateName)
public getAltPaths ( string $path ) : array
$path string Fancy path
Результат array Array of normal and alternate parsed path

loadModule() публичный Метод

Render a module by name
public loadModule ( string $moduleName, integer $style ) : string
$moduleName string The name of the module (real, eg 'Breadcrumbs' or folder, eg 'mod_breadcrumbs')
$style integer The rendering style, see JDocumentRendererModule::render
Результат string The rendered module

loadPosition() публичный Метод

Returns the contents of a module position
public loadPosition ( string $position, integer $style ) : string
$position string The position name, e.g. "position-1"
$style integer Rendering style, see JDocumentRendererModule::render
Результат string The contents of the module position

parsePath() публичный Метод

For example, media://com_foobar/css/test.css is parsed into media/com_foobar/css/test.css if no override is found, or templates/mytemplate/media/com_foobar/css/test.css if the current template is called mytemplate and there's a media override for it. Regarding plugins, templates are searched inside the plugin's tmpl directory and the template's html directory. For instance considering plugin://system/example/something the files will be looked for in: plugins/system/example/tmpl/something.php templates/yourTemplate/html/plg_system_example/something.php Template paths for plugins are uncommon and not standard Joomla! practice. They make sense when you are implementing features of your component as plugins and they need to provide HTML output, e.g. some of the integration plugins we use in Akeeba Subscriptions. The valid protocols are: media:// The media directory or a media override plugin:// Given as plugin://pluginType/pluginName/template, e.g. plugin://system/example/something admin:// Path relative to administrator directory (no overrides) site:// Path relative to site's root (no overrides)
public parsePath ( string $path, boolean $localFile = false ) : string
$path string Fancy path
$localFile boolean When true, it returns the local path, not the URL
Результат string Parsed path

route() публичный Метод

This method merges the route string with the url parameters defined in current url. The parameters defined in current url, but not given in route string, will automatically reused in the resulting url. But only these following parameters will be reused: option, view, layout, format Example: Assuming that current url is: http://fobar.com/index.php?option=com_foo&view=cpanel Result: http://fobar.com/index.php?option=com_foo&view=categories&layout=tree
public route ( string $route = '' ) : string
$route string The parameters string
Результат string The human readable, complete url

sefSort() публичный Метод

Creates a SEF compatible sort header. Standard Joomla function will add a href="#" tag, so with SEF enabled, the browser will follow the fake link instead of processing the onSubmit event; so we need a fix.
public sefSort ( string $text, string $field, stdClass $list ) : string
$text string Header text
$field string Field used for sorting
$list stdClass Object holding the direction and the ordering field
Результат string HTML code for sorting

Описание свойств

$container защищенное свойство

The component container
protected Container,FOF30\Container $container
Результат FOF30\Container\Container