more sugar for including lists of templates
This commit is contained in:
parent
dc99fd768a
commit
023e066971
1 changed files with 29 additions and 7 deletions
|
@ -26,29 +26,51 @@ function print_unescaped($string) {
|
|||
/**
|
||||
* Shortcut for adding scripts to a page
|
||||
* @param string $app the appname
|
||||
* @param string $file the filename
|
||||
* @param string|string[] $file the filename,
|
||||
* if an array is given it will add all scripts
|
||||
*/
|
||||
function script($app, $file) {
|
||||
OC_Util::addScript($app, $file);
|
||||
if(is_array($file)) {
|
||||
foreach($file as $f) {
|
||||
OC_Util::addScript($app, $f);
|
||||
}
|
||||
} else {
|
||||
OC_Util::addScript($app, $file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for adding styles to a page
|
||||
* @param string $app the appname
|
||||
* @param string $file the filename
|
||||
* @param string|string[] $file the filename,
|
||||
* if an array is given it will add all styles
|
||||
*/
|
||||
function style($app, $file) {
|
||||
OC_Util::addStyle($app, $file);
|
||||
if(is_array($file)) {
|
||||
foreach($file as $f) {
|
||||
OC_Util::addStyle($app, $f);
|
||||
}
|
||||
} else {
|
||||
OC_Util::addStyle($app, $file);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Shortcut for HTML imports
|
||||
* @param string $app the appname
|
||||
* @param string $file the path relative to the app's component folder
|
||||
* @param string|string[] $file the path relative to the app's component folder,
|
||||
* if an array is given it will add all components
|
||||
*/
|
||||
function component($app, $file) {
|
||||
$url = link_to($app, 'component/' . $file . '.html');
|
||||
OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
|
||||
if(is_array($file)) {
|
||||
foreach($file as $f) {
|
||||
$url = link_to($app, 'component/' . $f . '.html');
|
||||
OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
|
||||
}
|
||||
} else {
|
||||
$url = link_to($app, 'component/' . $file . '.html');
|
||||
OC_Util::addHeader('link', array('rel' => 'import', 'href' => $url));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue