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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Image Gallery JS components not loading on pages


Go to End


9 Posts   4088 Views

Avatar
Avatar8

Community Member, 8 Posts

4 February 2010 at 12:39pm

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

Avatar
UncleCheese

Forum Moderator, 4102 Posts

4 February 2010 at 1:23pm

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"

Avatar
Avatar8

Community Member, 8 Posts

5 February 2010 at 7:04am

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

5 February 2010 at 8:02am

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

The asset requirements are handled by the Requirements class.

Avatar
Avatar8

Community Member, 8 Posts

5 February 2010 at 9:45am

Edited: 05/02/2010 9:46am

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.

Avatar
kuenkuen82

Community Member, 41 Posts

3 May 2010 at 1:54pm

Edited: 04/05/2010 3:40pm

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

Avatar
coinoperated

Community Member, 2 Posts

26 September 2010 at 10:23pm

Edited: 26/09/2010 10:24pm

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

27 September 2010 at 1:52am

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

Go to Top