public static
|
#
addCSS( string $path )
Add a CSS file to the page generated by the CMS
Add a CSS file to the page generated by the CMS
Parameters
- $path
string - $path A fancy path definition understood by parsePath
See
|
public static
|
#
addJS( string $path, boolean $defer = false, boolean $async = false )
Add a JS script file to the page generated by the CMS.
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.
Parameters
- $path
string - $path A fancy path definition understood by parsePath
- $defer
boolean - $defer Adds the defer attribute, meaning that your script will only load after
the page has finished parsing.
- $async
boolean - $async Adds the async attribute, meaning that your script will be executed while
the resto of the page continues parsing.
See
|
public static
mixed
|
#
addLESS( string $path, string $altPath = null, boolean $returnPath = false )
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
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
Parameters
- $path
string - $path A fancy path definition understood by parsePath pointing to the source
LESS file
- $altPath
string - $altPath A 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
- $returnPath
boolean - $returnPath 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
Returns
mixed - True = successfully included generated CSS, False = the alternate CSS file was
used, null = the source file does not exist
Since
2.0
See
|
public static
string
|
#
sefSort( string $text, string $field, FOFUtilsObject $list )
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.
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.
Parameters
- $text
string - $text Header text
- $field
string - $field Field used for sorting
- $list
FOFUtilsObject - $list Object holding the direction and the ordering field
Returns
string - HTML code for sorting
|
public static
string
|
#
parsePath( string $path, boolean $localFile = false )
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.
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)
Parameters
- $path
string - $path Fancy path
- $localFile
boolean - $localFile When true, it returns the local path, not the URL
Returns
string - Parsed path
|
public static
array
|
#
getAltPaths( string $path )
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' );
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)
Parameters
- $path
string - $path Fancy path
Returns
array - Array of normal and alternate parsed path
|
public static
string
|
#
loadPosition( string $position, integer $style = -2 )
Returns the contents of a module position
Returns the contents of a module position
Parameters
- $position
string - $position The position name, e.g. "position-1"
- $style
integer - $style Rendering style; please refer to Joomla!'s code for more information
Returns
string - The contents of the module position
|
public static
string
|
#
route( string $route = '' )
Merges the current url with new or changed parameters.
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
Parameters
- $route
string - $route The parameters string
Returns
string - The human readable, complete url
|