Admiror Joomla! Community
http://www.vasiljevski.com/forum/

galleryView next and prev images not found
http://www.vasiljevski.com/forum/viewtopic.php?f=35&t=839
Page 1 of 1

Author:  santilin [ Fri Apr 12, 2013 8:57 am ]
Post subject:  galleryView next and prev images not found

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

Quote:
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:
Quote:
http://myserver/joomla/plugins/content/admirorgallery/admirorgallery/templates/galleryView/themes/light/prev.gif


How can I fix this whitout having to hardcode tha [b]joomla[b] subpath in the code?

Kind regards
--santilĂ­n

Author:  Vasiljevski [ Thu Apr 18, 2013 9:33 am ]
Post subject:  Re: galleryView next and prev images not found

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:
$AG->insertJSCode(' var full_loader_path = "'.$AG->pluginPath . $AG->currTemplateRoot.'";');


So add line from above in index.php in galleryView folder:
Code:
$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:
         $('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:
         $('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 :)

Author:  santilin [ Mon Apr 22, 2013 5:44 pm ]
Post subject:  Re: galleryView next and prev images not found

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:
         
            $('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:
                        loader_path = full_loader_path; //s.attr('src').split('jquery.galleryview')[0];
                        theme_path = loader_path + 'themes/';   


Thanks!

Author:  Vasiljevski [ Thu Apr 25, 2013 11:57 am ]
Post subject:  Re: galleryView next and prev images not found

Quote:
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 :)

Author:  santilin [ Mon Apr 29, 2013 9:07 am ]
Post subject:  [solved] Re: galleryView next and prev images not found

Ok, thanks, it works perfectly now.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/