Keyword

How to show gallery with single thumbnail inside K2 Content module

  • esedic
  • esedic's Avatar Topic Author
  • Offline
  • Senior Member
More
14 years 4 months ago #83732 by esedic
I thought I found a solution to my problem described in this topic: community.getk2.org/forum/topics/how-is-item-image-md5-hash (shortly: importing/assigning large number of images)  since I used gallery functionality to display images in the catalog, because gallery data is stored in the database. I did this by batch compressing images, batch extracting zip files to subdirectories and uploading all the folders to the server in the media/k2/galleries folder. And of course in the end with inserting data in the database: {gallery}folder_name{/gallery}.But of course it didn't quite work out since I want to use K2 Content module to display certain products on certain pages and this module doesn't have option to display gallery, but to display images only.Naively and simply I tried to put <?php echo $this->item->gallery; ?>  inside modules/mod_k2_content/tmpl/Default/default.php, but it doesn't work.Can anybody tell me, which files need to be changed for this to work?Any functions or plugins need to be triggered before?I added params option in the mod_k2_content.xml.Probably helper.php needs to be modified.Thanks for helping.

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

More
13 years 7 months ago #83733 by natecovington
Also looking for a solution to this for a client project.  I'll be taking a look into the code in a few days and will report back if I find a solution.

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

More
13 years 2 months ago #83734 by Steve Tustin
Did you find a solution short of just adding the {gallery}XX{/gallery} to the intro text?

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

More
11 years 7 months ago #83735 by Odin Mayland
Has anyone ever figured this out?

I have successfully used the following to get the Gallery to appear in the category view but this does not work when pasted into mod_k2_content/tmpl/Default/default.php
Log in  or Create an account to join the conversation.

More
11 years 6 months ago #83736 by Odin Mayland
I have also tried this in mod_k2_content/tmpl/Default/default.php but it only displays the first k2item on a blank white page.
Log in  or Create an account to join the conversation.

More
11 years 6 months ago #83737 by matthew turner
Hi Jeff,
Just found your post via twitter as they still have not added a following/subscribe option to posts that we have posted on (unless I've missed something!)

I did not realise this was no longer working and have just revisited my original posted code and adapted it to work.... I have added extra code so that you can leave the simple galley plugin folder settings left to default so it can be used outside of k2, oh and added option to switch single thumb on or off .

<?php
$app = &JFactory::getApplication();
$params = $app->getParams();
$parameter_get_value= $params->get( 'jw_sigpro' );

$params->set('galleries_rootfolder', 'media/k2/galleries');// galleries_rootfolder left on 'images/stories' default in plugin
$params->set('singlethumbmode', '0');// single thumb off - just an example!

echo JHTML::_('content.prepare', $item->gallery, $params );
?>

Again hope you see this post, and that it helps (I will reply this on both!).
Regards
Mat

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

More
11 years 6 months ago - 11 years 6 months ago #83738 by Odin Mayland
Mat,

Glad you found this.

I have pasted your code into templates/ja_t3_blank/html/mod_k2_content/nolink/default.php

No matter where I past it, the view only shows 1 of the items that do not have an image gallery.

Here is the normal view with all K2 items showing. The ones with titles only are the ones with only Imagegalleries.

Attachment not found




Here is what happens when I past your code in:

Attachment not found


1. The image gallery thumbnails are cropped.
2. They do not have titles
3. Only the first K2item with an itemImage shows.

If I click on the cropped thumbnail, the image gallery modal works perfectly:

Attachment not found



So the issues are titles, and getting the other itemImages to still show.

Here is the default.php file that is not working for me:

Attachment not found




Thanks for all your help,
Jeff
Attachments:

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

More
11 years 6 months ago #83739 by matthew turner
Hi Jeff,
I'm not sure whats going wrong for you there but I am more than happy to look at your file for you....
I tried downloading your attached file (default.php.zip ) but I keep getting a 500 error
Please repost it and I will have a look.
Regards
Mat
PS
Just noticed a Subscribe box under this very form (Check this box to be notified of replies to this topic.- yay!!) - I dont remember seeing that when I last posted? !!

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

More
11 years 6 months ago #83740 by Odin Mayland
Thanks for looking into this!

I have attached the file from templates/ja_t3_blank/html/mod_k2_content/nolink/default.php
Attachments:

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