Jump to:

7938 Posts in 1541 Topics by 945 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Image Gallery JS components not loading on pages

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 2496 Views
  • Avatar8
    Avatar
    Community Member
    8 Posts

    Image Gallery JS components not loading on pages Link to this post

    I'm having an issue where the Image Gallery js files for the chosen lightbox, etc. are not getting appended to the generated pages. Clicking on an gallery thumb just opens the full-size version in a new window.

    As a work around, I've placed calls to the necessary js files at the end of my page.ss template. This allows the lightbox function to work, but it's an undesirable workaround.

    I've also noticed that js files from other modules, such as the Thickbox module, are not being called either. Am I missing somthing? I've placed the module folders in the site root, named them correctly, done a dev/build?flush=1 as per the instructions. Any help is very welcome.

    Thanks,
    PM

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery JS components not loading on pages Link to this post

    Is the module in a directory named "image_gallery"? or is it another name? For the files to be found, you must name your module directory "image_gallery"

  • Avatar8
    Avatar
    Community Member
    8 Posts

    Re: Image Gallery JS components not loading on pages Link to this post

    Thanks for giving me some help:)

    The module directory is indeed named "image_gallery". I made sure of that when this first happened.

    Oddly, the gallery seems to work perfectly with the blackcandy template engaged, but not my new template. I've tried identifying the code difference between my template and the default one, but neither the main page.ss or layout page.ss have any differences, other than the layout structure.

    I've noticed that in the generated code, the script calls show up between the last </div> and </body>. What's the mechanism for calling them there, that I don't see in the template .ss files?

    The fact that the Image Gallery module works fine with the default template indicates that the installation is fine. I know I'm missing something in my template, but i don't know enough about how the js files get called to identify what it is.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery JS components not loading on pages Link to this post

    Send me a link and I'll take a look.

    The asset requirements are handled by the Requirements class.

  • Avatar8
    Avatar
    Community Member
    8 Posts

    Re: Image Gallery JS components not loading on pages Link to this post

    Here's a link to the gallery:

    http://www.hiphient.com/photos/

    To get the gallery working, I pasted the following four lines of code into my page.ss file at the end:

    <script src="/image_gallery/javascript/imagegallery_init.js?m=1251465430" type="text/javascript"></script>
    <script src="/image_gallery/gallery_ui/fancybox/javascript/jquery.fancybox-1.0.0.js?m=1251465396" type="text/javascript"></script>
    <script src="/image_gallery/gallery_ui/fancybox/javascript/jquery.pngFix.pack.js?m=1251465401" type="text/javascript"></script>
    <script src="/image_gallery/gallery_ui/fancybox/javascript/fancybox_init.js?m=1252375526" type="text/javascript"></script>

    Thanks for taking a look.

  • kuenkuen82
    Avatar
    Community Member
    41 Posts

    Re: Image Gallery JS components not loading on pages Link to this post

    I see your problem is fixed which is cool. I have a problem which is relating to this, I would like to know where in the imag_gallery PHP does it

    Requirements::javascript...

    the javascript plugin that I pointed to use in the CMS

    ... ok it was a stupid question, finally found it in gallery_ui/shadow/code

  • coinoperated
    Avatar
    Community Member
    2 Posts

    Re: Image Gallery JS components not loading on pages Link to this post

    I have installed SS version 2.4.2, and I was having trouble showing my image gallery in the front page because jquery and prototype weren't loading correctly, so I changed these two lines in image_gallery/code/ImageGalleryPage.php (function starts at line 247):

    private static function prototype2jquery() {
    //Requirements::block('jsparty/prototype.js');
    Requirements::block('sapphire/thirdparty/prototype/prototype.js');

    //Requirements::javascript('jsparty/jquery/jquery.js');
    Requirements::javascript('sapphire/thirdparty/jquery/jquery.js');
    }

    Hope that helps someone.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Image Gallery JS components not loading on pages Link to this post

    That function hasn't existed in a long time. Where did you get this from? Line 247 of ImageGalleryPage.php is this:

       protected function Items($limit = null) {
          if($limit === null && $this->MediaPerPage ) {
             if( !isset($_REQUEST['start']) || ! is_numeric( $_REQUEST['start'] ) )
                $_REQUEST['start'] = 0;
             
             $limit = $_REQUEST['start'] . "," . $this->MediaPerPage;
          }

    ---------------
    Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com

    2496 Views
Page: 1 2
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.