Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe FOFTemplateUtils

Fonctions membres publiques statiques

static addCSS ($path)
 
static addJS ($path, $defer=false, $async=false)
 
static addLESS ($path, $altPath=null, $returnPath=false)
 
static sefSort ($text, $field, $list)
 
static parsePath ($path, $localFile=false)
 
static getAltPaths ($path)
 
static loadPosition ($position, $style=-2)
 
static route ($route='')
 

Documentation des fonctions membres

◆ addCSS()

static addCSS (   $path)
static

Add a CSS file to the page generated by the CMS

Paramètres
string$pathA fancy path definition understood by parsePath
Voir également
FOFTemplateUtils::parsePath
Renvoie
void

Références $document, $path, $url, et FOFPlatform\getInstance().

Référencé par FOFForm\loadCSSFiles().

◆ addJS()

static addJS (   $path,
  $defer = false,
  $async = false 
)
static

Add a JS script file to the page generated by the CMS.

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.

Paramètres
string$pathA fancy path definition understood by parsePath
boolean$deferAdds the defer attribute, meaning that your script will only load after the page has finished parsing.
boolean$asyncAdds the async attribute, meaning that your script will be executed while the rest of the page continues parsing.
Voir également
FOFTemplateUtils::parsePath
Renvoie
void

Références $document, $path, $url, et FOFPlatform\getInstance().

Référencé par FOFForm\loadJSFiles().

◆ addLESS()

static addLESS (   $path,
  $altPath = null,
  $returnPath = false 
)
static

Compile a LESS file into CSS and add it to the page generated by the CMS. 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

Paramètres
string$pathA fancy path definition understood by parsePath pointing to the source LESS file
string$altPathA fancy path definition understood by parsePath pointing to a precompiled CSS file, used when we can't write the generated file to the output directory
boolean$returnPathReturn 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
Voir également
FOFTemplateUtils::parsePath
Depuis
2.0
Renvoie
mixed True = successfully included generated CSS, False = the alternate CSS file was used, null = the source file does not exist

Références $document, $id, $path, $url, elseif, FOFPlatform\getInstance(), et null.

Référencé par FOFForm\loadCSSFiles().

◆ getAltPaths()

static getAltPaths (   $path)
static

Parse a fancy path definition into a path relative to the site's root. 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)

Paramètres
string$pathFancy path
Renvoie
array Array of normal and alternate parsed path

Références $file, $path, $position, DIRECTORY_SEPARATOR, et FOFPlatform\getInstance().

◆ loadPosition()

static loadPosition (   $position,
  $style = -2 
)
static

Returns the contents of a module position

Paramètres
string$positionThe position name, e.g. "position-1"
int$styleRendering style; please refer to Joomla!'s code for more information
Renvoie
string The contents of the module position

Références $document, $mod, $params, $position, $renderer, $style, et FOFPlatform\getInstance().

◆ parsePath()

static parsePath (   $path,
  $localFile = false 
)
static

Parse a fancy path definition into a path relative to the site's root, respecting template overrides, suitable for inclusion of media files. 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.

The valid protocols are: media:// The media directory or a media override admin:// Path relative to administrator directory (no overrides) site:// Path relative to site's root (no overrides)

Paramètres
string$pathFancy path
boolean$localFileWhen true, it returns the local path, not the URL
Renvoie
string Parsed path

Références $path, $url, DIRECTORY_SEPARATOR, elseif, FOFPlatform\getInstance(), et JDEBUG.

Référencé par PostinstallControllerMessage\action(), PostinstallModelMessages\addPostInstallationMessage(), FOFUtilsInstallscript\addPostInstallationMessage(), FOFFormHeaderFieldselectable\getOptions(), FOFFormFieldList\getOptions(), et PostinstallModelMessages\onProcessList().

◆ route()

static route (   $route = '')
static

Merges the current url with new or changed parameters.

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

<?php echo FOFTemplateutils::route('view=categories&layout=tree'); ?>

Result: http://fobar.com/index.php?option=com_foo&view=categories&layout=tree

Paramètres
string$routeThe parameters string
Renvoie
string The human readable, complete url

Références $parts, $route, $url, et elseif.

◆ sefSort()

static sefSort (   $text,
  $field,
  $list 
)
static

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.

Paramètres
string$textHeader text
string$fieldField used for sorting
FOFUtilsObject$listObject holding the direction and the ordering field
Renvoie
string HTML code for sorting

Références $field, $list, et $text.


La documentation de cette classe a été générée à partir du fichier suivant :