3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2766 Views |
-
Requirements::javascript can't load my js file

14 March 2009 at 12:53am
Hi.
I've created a new Page type. The template for this page type i've put in the Layout folder.
Now when i try to add Requirements::javascript( 'myjsfile.js' ); I know it needs to be in function init in the controller.
It doesn't add it to my main Page.ss file.
Any ideas?
-
Re: Requirements::javascript can't load my js file

14 March 2009 at 2:02am
Hi DeLisle, welcome to Silverstripe
You need to put the full path of your file in there, so something like:
Requirements::javascript( 'mysite/javascript/myjsfile.js' );
Silverstripe is smart in that if it doesn't find your file at the specified path it wont try to include it.
-
Re: Requirements::javascript can't load my js file

14 March 2009 at 2:07am
Thanks for your reploy however,
i've alread tried adding the full path, it doesn't help. -
Re: Requirements::javascript can't load my js file

14 March 2009 at 2:23am
hmm thats strange, it can only be one of two things, either the path is wrong on the innit function syntax is wrong, could you post your innit() code?
-
Re: Requirements::javascript can't load my js file

14 March 2009 at 2:28am
Andrew is using a heavily customized SSViewer implementation, so the problem is most likely not in SilverStripe core
-
Re: Requirements::javascript can't load my js file

21 April 2012 at 9:42pm
i have placed my .js file in mysite/code/page.php ... like
public function init() {
parent::init();
Requirements::javascript("themes/my-theme/js/jquery.js");
Requirements::javascript("themes/my-theme/js/cufon-yui.js");
Requirements::javascript("themes/my-theme/js/Avenir_Next_LT_Pro_500.font.js");
Requirements::javascript("themes/my-theme/js/Avenir_Next_LT_Pro_600.font.js");
Requirements::javascript("themes/my-theme/js/Adelle_Rg_italic_400.font.js");}
for now i need to Write some code like
<script type="text/javascript" src="js/Avenir_Next_LT_Pro_500.font.js"></script>
<script type="text/javascript">
Cufon.replace('.block1-title');
Cufon.replace('.news-title');
</script>how can i write code linke this... in siverstripe
plz any one help !!!
Thanks in advance
| 2766 Views | ||
|
Page:
1
|
Go to Top |



