Page 1 of 1

galleryView next and prev images not found

Posted: Fri Apr 12, 2013 8:57 am
by santilin
Hi, this is (I believe) a bug related with my other "finding" on theme_path [http://www.vasiljevski.com/forum/viewtopic.php?f=35&t=783].

The theme_path variable is used just to get to the next and previous images and in the original code it failed to be set, so we have to hardcode it at the top of the jquery.galleryview-2.1.1.js file like this:

Code: Select all

var loader_path = 'plugins/content/admirorgallery/admirorgallery/templates/galleryView/';
var theme_path = loader_path + 'themes/';


However, it still fails to find the images. For it to find them, the theme_path should include the dir where joomla is installed on my server.

The problem is that it is looking for the images at:
http://myserver/plugins/content/admirorgallery/admirorgallery/templates/galleryView/themes/light/prev.gif
which fails because joomla is at http://myserver/joomla/ and the galleryView images are at:
http://myserver/joomla/plugins/content/admirorgallery/admirorgallery/templates/galleryView/themes/light/prev.gif
How can I fix this whitout having to hardcode tha joomla subpath in the code?

Kind regards
--santilĂ­n

Re: galleryView next and prev images not found

Posted: Thu Apr 18, 2013 9:33 am
by Vasiljevski
Well previous proposed solution, by me, was not so nice :)

Better solution would be to define a variable and add path from PHP, then later use it in the script, something like:

Code: Select all

$AG->insertJSCode(' var full_loader_path = "'.$AG->pluginPath . $AG->currTemplateRoot.'";');
So add line from above in index.php in galleryView folder:

Code: Select all

$AG->loadCSS($AG->currTemplateRoot.'galleryview.css');
$AG->loadCSS($AG->currTemplateRoot.'albums/albums.css');
$AG->loadCSS($AG->currTemplateRoot.'pagination/pagination.css');

$AG->insertJSCode(' var full_loader_path = "'.$AG->pluginPath . $AG->currTemplateRoot.'";');

$AG->loadJS($AG->currTemplateRoot.'jquery.timers-1.2.js');
$AG->loadJS($AG->currTemplateRoot.'jquery.easing.1.3.js');
$AG->loadJS($AG->currTemplateRoot.'jquery.galleryview-2.1.1.js');
Then in "jquery.galleryview-2.1.1.js" change this part:

Code: Select all

			$('script').each(function(i){
				var s = $(this);
				if(s.attr('src') && s.attr('src').match(/jquery\.galleryview/)){
					loader_path = s.attr('src').split('jquery.galleryview')[0];
					theme_path = s.attr('src').split('jquery.galleryview')[0]+'themes/';	
				}
			});
to

Code: Select all

			$('script').each(function(i){
				var s = $(this);
				if(s.attr('src') && s.attr('src').match(/jquery\.galleryview/)){
					loader_path = full_loader_path; //s.attr('src').split('jquery.galleryview')[0];
					theme_path = s.attr('src').split('jquery.galleryview')[0]+'themes/';	
				}
			});
This should be more bulletproof solution :)

Re: galleryView next and prev images not found

Posted: Mon Apr 22, 2013 5:44 pm
by santilin
I had to remove the initial slash from the "/"+theme_path expressions when adding the images.

Now it works like a charm!

Only a doubt, why is still necessary the old code to get the theme path?

Code: Select all

         
            $('script').each(function(i){
            var s = $(this);
            if(s.attr('src') && s.attr('src').match(/jquery\.galleryview/)){
               loader_path = s.attr('src').split('jquery.galleryview')[0];
               theme_path = s.attr('src').split('jquery.galleryview')[0]+'themes/';   
            }
         });
Wouldn't be just enough to set:

Code: Select all

                        loader_path = full_loader_path; //s.attr('src').split('jquery.galleryview')[0];
                        theme_path = loader_path + 'themes/';   
Thanks!

Re: galleryView next and prev images not found

Posted: Thu Apr 25, 2013 11:57 am
by Vasiljevski
Wouldn't be just enough to set:

Code:
loader_path = full_loader_path; //s.attr('src').split('jquery.galleryview')[0];
theme_path = loader_path + 'themes/';


Thanks!
Yes, you are right, it would be enough :)

When I saw your post and investigated the issue, I was working on something else, and honestly didn't pay much attention, I just wanted to make it work :)

[solved] Re: galleryView next and prev images not found

Posted: Mon Apr 29, 2013 9:07 am
by santilin
Ok, thanks, it works perfectly now.