Jump to:

22977 Posts in 11806 Topics by 2826 members

General Questions

SilverStripe Forums » General Questions » Javascript doesn't show up. Why?

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1795 Views
  • NtM
    Avatar
    Community Member
    39 Posts

    Javascript doesn't show up. Why? Link to this post

    This is what I'm writing in Page.php Controller:

    public function init() {
          parent::init();
          Requirements::JavaScript('/mysite/javascript/jquery.js');
    Requirements::JavaScript('/mysite/javascript/dropdownmenu.js');
    }

    But my page doesn't show my scripts. What is wrong?
    It doesn't work in FF and it doen't in IE... I tried to put this line "ContentNegotiator::disable();" in _config.php - doesn't work eather.

  • Willr
    Avatar
    Forum Moderator
    5462 Posts

    Re: Javascript doesn't show up. Why? Link to this post

    Requirements::JavaScript('/mysite/javascript/jquery.js');

    Should be

    Requirements::javascript('mysite/javascript/jquery.js');

    Note the lower case 'javascript' and mysite usually shouldn't have a / in front of it

  • NtM
    Avatar
    Community Member
    39 Posts

    Re: Javascript doesn't show up. Why? Link to this post

    Thank you very much for the help!

  • PitrusCitrus
    Avatar
    Community Member
    3 Posts

    Re: Javascript doesn't show up. Why? Link to this post

    Hi, Im new to SilverStripe and have just run thru the first tutorials, when I tryed to implement the image gallery everything worked fine but thats when I discovered that the javascript wont show in the head section. Can I have messed up some other file? dont have a clue about this. ive tryed different paths, nothing seems to get the javascript to show up in the <head> section. The css loads but not the javascript im really clueles?!

    somehow I got the gallery javascript working but when I try to add new javascript to HomePage I cant????

  • Naren
    Avatar
    Community Member
    21 Posts

    Re: Javascript doesn't show up. Why? Link to this post

    Hi Will,

    I am doing the same as you mentioned but javascript still not working. I am doing it with

    Requirements::javascript('radhika/js/jquery.js');
          Requirements::javascript('radhika/js/jquery-1.8.2.min.js');
          Requirements::javascript('radhika/js/jquery.easing.min.js');
          Requirements::javascript('radhika/js/jquery.isotope.min.js');      
          Requirements::javascript('radhika/js/modernizr.custom.97074.js');
          Requirements::javascript('radhika/js/jquery.hoverdir.js');
          Requirements::javascript('radhika/js/jquery.nicescroll.min.js');
          Requirements::javascript('radhika/js/jquery.fancybox.js');      
          Requirements::javascript('radhika/js/supersized.3.2.7.min.js');
          Requirements::javascript('radhika/js/supersized.shutter.min.js');
          Requirements::javascript('radhika/js/superfish.js');
          Requirements::javascript('radhika/js/tweetable.js');
          Requirements::javascript('radhika/js/timeago.js');      
          Requirements::javascript('radhika/js/jflickrfeed.min.js');
          Requirements::javascript('radhika/js/cycle.js');
          Requirements::javascript('radhika/js/jquery-ui.js');
          Requirements::javascript('radhika/js/viewport.js');
          Requirements::javascript('radhika/js/jwplayer.js');      
          Requirements::javascript('radhika/js/jquery.flexslider-min.js');
          Requirements::javascript('radhika/js/jquery.carouFredSel-6.1.0-packed.js');
          Requirements::javascript('radhika/js/plugin/jquery.form.js');
          Requirements::javascript('radhika/js/thememarket.js');

    Guide me where i am wrong

    Thanks in advance

  • kinglozzer
    Avatar
    Community Member
    138 Posts

    Re: Javascript doesn't show up. Why? Link to this post

    Naren,

    Is the path definitely correct? It's not 'themes/radhika/js...'?

    Also, there's a heck of a lot of JavaScript there, your page size is going to be huge. You can use one script for more than thing, for example you can use carouFredSel to do everything that flexslider.js/carousel.js can do. It also appears you're trying to include jQuery twice (the first two).

    Loz

    1795 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.