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.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Image Gallery JS components not loading on pages

Go to End

9 Posts   2533 Views


4 February 2010 at 12:39pm Community Member, 8 Posts

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 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.



4 February 2010 at 1:23pm 4085 Posts

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"


5 February 2010 at 7:04am Community Member, 8 Posts

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 or layout 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.


5 February 2010 at 8:02am 4085 Posts

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

The asset requirements are handled by the Requirements class.


5 February 2010 at 9:45am (Last edited: 5 February 2010 9:46am), Community Member, 8 Posts

Here's a link to the gallery:


To get the gallery working, I pasted the following four lines of code into my 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.


3 May 2010 at 1:54pm (Last edited: 4 May 2010 3:40pm), Community Member, 41 Posts

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


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


26 September 2010 at 10:23pm (Last edited: 26 September 2010 10:24pm), Community Member, 2 Posts

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() {


Hope that helps someone.


27 September 2010 at 1:52am 4085 Posts

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.

Go to Top