Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

Requirements not loading at all


Reply


2 Posts   1184 Views

Avatar
Punch Rockgroin

Community Member, 8 Posts

24 March 2010 at 7:57am

Edited: 24/03/2010 9:05am

Hi... I've run into a situation that I've never had on any other Silverstripe site - I can't get Requirements to load at all:

In my mysite/code/Page.php

class Page_Controller extends ContentController {
   
   public function init() {
      parent::init();
Requirements::javascript("themes/RAC/js/customJquery.js");

   }
}

Doesn't load anything - so I figured it might be something I'm doing so i changed

Requirements::javascript("themes/RAC/js/customJquery.js");

to

Requirements::customScript(<<<JS
alert("hi there");
JS
);

just to see but no custom scripts or css is loading at all -

I'm going to try reinstalling the core just incase something got borked there but any ideas?

Dave

EDIT:

Hmm... Nothing on the reinstall but I added Requirements::set_write_js_to_body(false); to _config and now it works. It shouldn't do that though right? As well, CustomCSS doesn't work either so something is certainly off.

Avatar
reececropley

Community Member, 11 Posts

6 March 2012 at 11:21pm

Hello Punch Rockgroin,

Im having the exact same problem but only one some pages.

Will adding Requirements::set_write_js_to_body(false); to the config file break the pages that are working?

TIA

Reece