Mini Gallery Plugin loading when it shoudlnt be

More
14 years 15 hours ago #11889 by gswahhab
Hello,

The issue i am having is that in category view the mini gallery plugin is loading even though it is not inserted in the template.

I did some testing with the plugin with echo statements and it directly correlates.

So if i have 2 items that contain a minigallery it is activating the plugin 2 times in category view even though the plugin is not in the template.

IE then throws the errors

'this.container' is null or not an object
slideshow.js Line: 35
Code: 0 Char: 4
URI: .../minigallery/slideshow.js

on the category view page.

These errors seem to indicate that it is looking for the rest of the info being passed from the gallery but since there isnt one there its giving these errors.

When i am on the detail view page with the mingallery in it, it works fine.

i cant figure out why its loading minigallery when it shouldnt be

Please Log in or Create an account to join the conversation.

More
14 years 10 hours ago #11903 by micker
try this
<!-- l --><a class="postlink-local" href=" www.flexicontent.org/phpbb/viewtopic.php?f=18&t=2512 ">viewtopic.php?f=18&t=2512
regards

FLEXIcontent is Free but involves a very big effort on our part.
Like the our support? (for a bug-free FC, despite being huge extension) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing reviews. Thanks![/size]

Please Log in or Create an account to join the conversation.

More
14 years 4 hours ago #11921 by gswahhab
thank you for the link. it is a very nice plugin but we prefer the mini gallery because it includes the thumbnails below.

is this another known bug or is the behavior not correct. I would think that it is not supposed to load the plugin at all?

or at least if you could point me in the right direction.

Thanks,
Gabe

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #12383 by paulmcd
Seeing as how no-one from FLEXIcontent seems bothered to actually help anyone with their problems I found a solution to this - at least for my purposes - which works.

I should point out before sharing that I knew/know the categories of my site in which people would be using the plugin. That was the foundation of my fix.

First step is to use some code in your Joomla template (just before the </head>) to ascertain the category to which the current page belongs:
Code:
<?php $db = &JFactory::getDBO(); $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); $temp = JRequest::getString('id'); $temp = explode(':', $temp); $id = $temp[0]; $db->setQuery('SELECT cat.title FROM #__categories cat RIGHT JOIN #__content cont ON cat.id = cont.catid WHERE cont.id='.$id); $category_title = $db->loadResult(); ?>

Second step is copy out from your browser's View Source the code inserted by the minigallery plugin. In my case it looked like this, albeit wrapped in a script declaration:
Code:
window.addEvent('domready',function(){ var obj = { wait: 4000, effect: 'fade', direction: 'right', duration: 1000, loop: true, thumbnails: true, backgroundSlider: true } show = new SlideShow('slideshowContainer','slideshowThumbnail',obj); show.play(); });

Third step is to write an If/then in your Joomla template along the lines of "if the current category variable is a category in which the plugin is used, then write the necessary code". In my case:
Code:
<?php if ($category_title == "YOUR_CATEGORY_NAME_HERE") { ?> <link rel="stylesheet" href="<?php echo $this->baseurl ?>/plugins/flexicontent_fields/minigallery/minigallery.css" type="text/css" /> <script type="text/javascript" src="<?php echo $this->baseurl ?>/plugins/flexicontent_fields/minigallery/backgroundslider.js"></script> <script type="text/javascript" src="<?php echo $this->baseurl ?>/plugins/flexicontent_fields/minigallery/slideshow.js"></script> <script type="text/javascript"> window.addEvent('domready',function(){ var obj = { wait: 4000, effect: 'fade', direction: 'right', duration: 1000, loop: true, thumbnails: true, backgroundSlider: true } show = new SlideShow('slideshowContainer','slideshowThumbnail',obj); show.play(); }); </script> <?php } ?>

Then, fourthly and finally, in the file minigallery.php (/plugins/flexicontent_fields/), comment out lines 253 to 276 inclusive - that's the part that writes the JavaScript to your Joomla template as long as there are values - NOT as long as they are needed.

That part should start after "if ($values) {" and end with "$document->addScriptDeclaration($js);"

That ill-conceived logic played havoc with my category listings.

Hope that helps someone else and saves them the hair-pulling I had.

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #12384 by paulmcd
Just to clarify on my posting above, the commenting of the minigallery.php should look like this when you've done it ...
Code:
if ($values) { // JHTML::_('behavior.mootools'); // $document->addStyleSheet('plugins/flexicontent_fields/minigallery/minigallery.css'); // this allows you to override the default css files // $document->addStyleSheet(JURI::base().'/templates/'.$mainframe->getTemplate().'/css/minigallery.css'); JHTML::_('behavior.mootools'); // $document->addScript('plugins/flexicontent_fields/minigallery/backgroundslider.js'); // $document->addScript('plugins/flexicontent_fields/minigallery/slideshow.js'); // $js = " // window.addEvent('domready',function(){ // var obj = { // wait: ".$field->parameters->get( 'wait', 4000 ).", // effect: '".$field->parameters->get( 'effect', 'fade' )."', // direction: '".$field->parameters->get( 'direction', 'right' )."', // duration: ".$field->parameters->get( 'duration', 1000 ).", // loop: ".$field->parameters->get( 'loop', 'true' ).", // thumbnails: true, // backgroundSlider: true // } // show = new SlideShow('slideshowContainer','slideshowThumbnail',obj); // show.play(); // }); // "; // $document->addScriptDeclaration($js); $css = "

I left the opening 'if' in place cos there are further parameters to it.

Please Log in or Create an account to join the conversation.

More
13 years 11 months ago #12385 by gswahhab
thanks for posting your solutions makes sense. going to be trying out soon.

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.478 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline