mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #4894 from spekulatius/patch-1
DOCS moving to spaces for some examples
This commit is contained in:
commit
65a6f3d148
@ -30,37 +30,37 @@ as close to rendering as possible (e.g. in `[api:FormField]`.
|
|||||||
|
|
||||||
class MyCustomController extends Controller {
|
class MyCustomController extends Controller {
|
||||||
|
|
||||||
public function init() {
|
public function init() {
|
||||||
parent::init();
|
parent::init();
|
||||||
|
|
||||||
Requirements::javascript("cms/javascript/LeftAndMain.js");
|
Requirements::javascript("cms/javascript/LeftAndMain.js");
|
||||||
Requirements::css("cms/css/TreeSelector.css");
|
Requirements::css("cms/css/TreeSelector.css");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
### CSS Files
|
### CSS Files
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
Requirements::css($path, $media);
|
Requirements::css($path, $media);
|
||||||
|
|
||||||
If you're using the CSS method a second argument can be used. This argument defines the 'media' attribute of the
|
If you're using the CSS method a second argument can be used. This argument defines the 'media' attribute of the
|
||||||
`<link>` element, so you can define 'screen' or 'print' for example.
|
`<link>` element, so you can define 'screen' or 'print' for example.
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
Requirements::css("cms/css/TreeSelector.css", "screen,projection");
|
Requirements::css("cms/css/TreeSelector.css", "screen,projection");
|
||||||
|
|
||||||
### Javascript Files
|
### Javascript Files
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
Requirements::javascript($path);
|
Requirements::javascript($path);
|
||||||
|
|
||||||
A variant on the inclusion of custom javascript is the inclusion of *templated* javascript. Here, you keep your
|
A variant on the inclusion of custom javascript is the inclusion of *templated* javascript. Here, you keep your
|
||||||
JavaScript in a separate file and instead load, via search and replace, several PHP-generated variables into that code.
|
JavaScript in a separate file and instead load, via search and replace, several PHP-generated variables into that code.
|
||||||
|
|
||||||
:::php
|
:::php
|
||||||
$vars = array(
|
$vars = array(
|
||||||
"EditorCSS" => "cms/css/editor.css",
|
"EditorCSS" => "cms/css/editor.css",
|
||||||
);
|
);
|
||||||
|
|
||||||
Requirements::javascriptTemplate("cms/javascript/editor.template.js", $vars);
|
Requirements::javascriptTemplate("cms/javascript/editor.template.js", $vars);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user