in a silverstripe project I´m loading whole pages via ajax. Therefore I added to the Page-Contoller following function:
public function ajax(){
return $this->renderWith('MyTemplate');
}
This works fine so far and I get the page rendered as I want when browsing to mysite.com/mypage/ajax. The only Problem are the included JS/CSS Files in the template "MyTemplate":
<% require javascript(my.js) %>
<% require css(my.css) %>
The css/js does not show up in the source code - somehow it is not included, although it is part of the template "MyTemplate".
So is there a way to add the css/js in a cool way with silverstripe methods?
I tried this:
public function ajax(){
Requirements::css("my.js");
return $this->renderWith('ProjectPage');
}
but no success so far. Many thanks, Florian