Keyword

Getting sig pro to work with a K2 item image without an image gallery attached

  • lynton
  • lynton's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #81525 by lynton
Hi, Ive been trying to get  K2 item images to use the sig pro plugin in the same way that the image gallery does.  This is so that I get consistency when viewing the item image and the gallery image.By default the layout item.php uses   <a class="modal" ...  for showing the enlarged item image.I changed this to use <a class="sig-link highslide"  and this worked very nicely for items that also had image galleries attached.  The item image then would display in the same way that the gallery images do when enlarged and was even integrated into the slideshow presentation.However on items without an image gallery the sigpro plugin is not enabled and it will not work.Can anyone advise me how to get the sigpro plugin enabled for K2 items that DONT have an image gallery , so that it can be used to display the single K2 item image, in all items ?thankslyntonok I found a way to get this to work I inserted an empty gallery tag if one is not present already.This was enough to get sigpro to add the required functions even though there is nogallery present.So now I have the item image popup and the gallery popups using sigpro as I wanted.  :)Even better when a gallery IS present the slideshow will include the item image as well !!!In the components/com_k2/models/item.php file around line 161 
// begin hack            if ( !isset($item->gallery) ) {                $item->gallery='{gallery},{/gallery}';            }// end of hack.            $item->text=$item->gallery;            $dispatcher->trigger ( 'onPrepareContent', array (&$item, &$params, $limitstart ) );            $item->gallery=$item->text;and in the layout item.phpchanged the image poup  link to match what the gallery would generate.<a class="sig-link highslide" href="<?php echo $this->item->imageXLarge; ?>"   ....  </a>

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

  • lynton
  • lynton's Avatar Topic Author
  • Offline
  • New Member
More
14 years 1 month ago #81526 by lynton
damn it didnt quite work, I also had to modify
plugins/content/jw_sigpro.php to stop it producing an empty list of gallery images by breaking out of the processing loop if the gallery is empty.

about line 155:

if (preg_match_all($regex, $row->text, $matches, PREG_PATTERN_ORDER) > 0) {
// start the replace loop
foreach ($matches[0] as $key => $match) {
$tagcontent = preg_replace("/{.+?}/", "", $match);
// hack start
if (empty($tagcontent)){$row->text='';break;}
// hack end
$tagparams = explode(':',$tagcontent);
$gal_folder = $tagparams[0];


also in the previous post the hack needed to be if (empty($item->gallery)) rather than if(!isset($item->gallery)).

sure this is a hack but it solves the issue for me so Ive posted to help out any other poor hackers.

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

More
14 years 1 month ago #81527 by scyllar
Thanks for sharing! I love hacks!

Lynton Reed said:sure this is a hack but it solves the issue for me so Ive posted to help out any other poor hackers.

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


Powered by Kunena Forum