galleryView next and prev images not found

Everything to do with Templates and Templating for Admiror Gallery.
Post Reply
Message
Author
santilin
Posts: 6
Joined: Wed Feb 20, 2013 11:12 am

galleryView next and prev images not found

#1 Post 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

Admiror Gallery 5 - Fundraising Campaign

User avatar
Vasiljevski
Developer
Developer
Posts: 1258
Joined: Sat Aug 14, 2010 9:31 pm
Location: Novi Sad, Serbia
Contact:

Re: galleryView next and prev images not found

#2 Post 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 :)
Help Admiror Gallery become even better,
give us a review on JED

santilin
Posts: 6
Joined: Wed Feb 20, 2013 11:12 am

Re: galleryView next and prev images not found

#3 Post 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!

User avatar
Vasiljevski
Developer
Developer
Posts: 1258
Joined: Sat Aug 14, 2010 9:31 pm
Location: Novi Sad, Serbia
Contact:

Re: galleryView next and prev images not found

#4 Post 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 :)
Help Admiror Gallery become even better,
give us a review on JED

santilin
Posts: 6
Joined: Wed Feb 20, 2013 11:12 am

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

#5 Post by santilin »

Ok, thanks, it works perfectly now.

Admiror Gallery 5 - Fundraising Campaign

Post Reply