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

Can I use the lightboxes in ImageGalleryModule on other pages within my site?


Reply


7 Posts   1355 Views

Avatar
zim

Community Member, 135 Posts

1 November 2009 at 7:34am

I want to pop a youtube link into one of the cool lightboxes used by the ImageGalleryModule. From Another page on my site. My home page in fact

I have link to the prettyphoto.js file in image_gallery/javascript/prettyphoto/prettyphoto.js

and have used the code form prettyphoto web site to try and implemet lightbox

http://www.no-margin-for-errors.com/projects/prettyPhoto-jquery-lightbox-clone/

but i think there is some kind of jquery problem

i drop the below into the page just before closing </body> tag as instructed and have also tried to change $ - $jQuery.

<script type="text/javascript" charset="utf-8">
      $(document).ready(function(){
         $("a[rel^='prettyPhoto']").prettyPhoto();
      });
   </script>

Does anyone know why this would not work I am definately linking to the prettyphoto.js file as put in an alert to test :(

Avatar
zim

Community Member, 135 Posts

4 November 2009 at 5:26am

I have nearly got this working.

I have included this in my HomePage.php

public function init()
   {

      parent::init();
      self::prototype2jquery();
      self::includeForPrettyPhoto();
      

   }

   private static function prototype2jquery() {
      Requirements::block('jsparty/prototype.js');
      Requirements::javascript('jsparty/jquery/jquery.js');
      Requirements::javascript('jsparty/jquery/jquery.cycle.js');
   }
   
   private static function includeForPrettyPhoto()
   {
      Requirements::javascript('image_gallery/javascript/prettyphoto/jquery.prettyPhoto.js');
      Requirements::javascript('image_gallery/javascript/prettyphoto/prettyphoto_init.js');

      Requirements::css('image_gallery/css/prettyphoto/prettyPhoto.css');
   }

and this link in my HomePage.ss

<a href="http://www.youtube.com/watch?v=qqXi8WmQ_WM" id="http://www.youtube.com/watch?v=qqXi8WmQ_WM" rel="prettyPhoto" >Video Title</a>

the prettyphoto box opens with the loading icon but nothing loads in??

any idea why. I am so close.

Avatar
UncleCheese

Forum Moderator, 4096 Posts

4 November 2009 at 5:58am

Are you sure that PrettyPhoto supports video? I think you probably want to direct your questions to the PrettyPhoto documentation, since this isn't really related to Silverstripe.

Avatar
zim

Community Member, 135 Posts

4 November 2009 at 6:13am

I have managed to get this working.

my problem was that in trying to use the image gallery version this does not support youtube links. basically had to get new version of prettyphoto and use files from this instead.

so i blocked this one and loaded my own. now works fine!

public function init()
   {

      parent::init();
      self::prototype2jquery();
      self::includeForPrettyPhoto();
      

   }

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

   }
   
   private static function includeForPrettyPhoto()
   {
      Requirements::block('image_gallery/javascript/prettyphoto/jquery.prettyPhoto.js');
      Requirements::javascript('jsparty/jquery/jquery.prettyPhoto.js');
      Requirements::javascript('image_gallery/javascript/prettyphoto/prettyphoto_init.js');

      Requirements::css('themes/tutorial/css/prettyPhoto.css');
   }

Avatar
zim

Community Member, 135 Posts

4 November 2009 at 6:16am

sorry to go on about non silverstripe stuff. But it is the case that the new version of pretty photo supports youtube links, as well as flash and .mov etc and is pretty easy to integrate into silverstripe....

Avatar
UncleCheese

Forum Moderator, 4096 Posts

4 November 2009 at 6:25am

Edited: 04/11/2009 6:26am

Looks like you're using a really old version of ImageGallery. All that includeForXXX() stuff is pretty old school. Glad it's working, though!

Avatar
zim

Community Member, 135 Posts

4 November 2009 at 7:00am

oh! ok. I downloaded the imagegallery module only one week ago from the silverstripe site?

Has it changed a lot? what are the benefits in the new version dude?