Stud.IP
2.0 Revision 48548
|
Static Public Member Functions | |
static | set_assets_url ($url) |
static | url ($to= '') |
static | img ($source, $opt=array()) |
static | image_path ($source) |
static | script ($atLeastOneArgument) |
static | javascript_path ($source) |
static | stylesheet ($atLeastOneArgument) |
static | stylesheet_path ($source) |
Data Fields | |
const | NUMBER_OF_ALIASES = 2 |
Static Public Attributes | |
static | $dynamic |
static | $counter_cache |
|
static |
Returns path to an image asset.
Example:
The src can be supplied as a...
full path, like "/my_images/image.gif"
file name, like "rss.png", that gets expanded to "/images/rss.png"
file name without extension, like "logo", that gets expanded to "/images/logo.gif"
|
static |
Returns an image tag using options as html attributes on the tag, but with these special cases:
'alt' - If no alt text is given, the file name part of the $source is used (capitalized and without the extension)
The source can be supplied as a...
|
static |
Returns path to a javascript asset.
Example:
Assets::javascript_path('ajax') => /javascripts/ajax.js
|
static |
Returns a script include tag per source given as argument.
Examples:
Assets::script('prototype') => <script src="/javascript/prototype.js"></script>
Assets::script('common.javascript', '/elsewhere/cools') => <script src="/js/common.javascript"></script> <script src="/elsewhere/cools.js"></script>
|
static |
This method sets the URL to your assets.
string | the URL to the assets |
|
static |
Returns a css link tag per source given as argument.
Examples:
Assets::stylesheet('style') => <link href="/stylesheets/style.css" media="screen" rel="stylesheet">
Assets::stylesheet('style', array('media' => 'all')) => <link href="/stylesheets/style.css" media="all" rel="stylesheet">
Assets::stylesheet('random.styles', '/css/stylish') => <link href="/stylesheets/random.styles" media="screen" rel="stylesheet"> <link href="/css/stylish.css" media="screen" rel="stylesheet">
|
static |
Returns path to a stylesheet asset.
Example:
stylesheet_path('style') => /stylesheets/style.css
|
static |
This class method is an accessor to the URL "prefix" for all things "asset" Prepend the return value of this method to the relative path of the wanted static content.
Additionally if the ASSETS_URL contains the string 'd', it will be replaced with a random number between 0 and 3. If you passed an argument this number will not be random but specific to that argument thus being referentially transparent.
Example:
$ASSETS_URL = 'http://www.example.com/public/'; echo Assets::url() . 'javascripts/prototype.js' . "\n"; echo Assets::url('javascripts/prototype.js') . "\n";
http://www.example.com/public/javascripts/prototype.js http://www.example.com/public/javascripts/prototype.js
$ASSETS_URL = 'http://www%d.example.com/public/'; echo Assets::url() . 'javascripts/prototype.js' . "\n"; echo Assets::url() . 'javascripts/prototype.js' . "\n"; echo Assets::url() . 'javascripts/prototype.js' . "\n"; echo Assets::url('javascripts/prototype.js') . "\n"; echo Assets::url('javascripts/prototype.js') . "\n"; echo Assets::url('javascripts/prototype.js') . "\n";
http://www0.example.com/public/javascripts/prototype.js http://www1.example.com/public/javascripts/prototype.js http://www2.example.com/public/javascripts/prototype.js http://www1.example.com/public/javascripts/prototype.js http://www1.example.com/public/javascripts/prototype.js http://www1.example.com/public/javascripts/prototype.js
string | an optional suffix which is used to construct a number if ASSETS_URL is dynamic (contains 'd') |
|
static |
|
static |
const NUMBER_OF_ALIASES = 2 |