Keyword

Simple Image Gallery does not work in k2

  • Rafael Bonce
  • Rafael Bonce's Avatar Topic Author
  • Offline
  • New Member
More
13 years 9 months ago #91214 by Rafael Bonce
Simple Image Gallery does not work in k2 was created by Rafael Bonce
I insert a picture in the extra field, create text area but does not show the image, only the code:  {gallery}images/stories/test{/gallery} 
the same happens with the YOOtheme mutibox {mbox: 50centb.jpg | width = 126 | height = 126 | = group albums | thumb = 50cent.jpg | 50 Cent title = | caption =} 50 Cent}
Attachments:

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

More
13 years 8 months ago #91215 by Rastislav Klc
Replied by Rastislav Klc on topic Simple Image Gallery does not work in k2
I have same problem,

did you ever get to fix this issue?

It is most likely because K2 does not output extra fields same way as it outputs main content. Extra fields don't get parsed  for plug-in tags, or something like this.

 

Can someone who knows solution to this problem (or workaround) share with us.

I personally would rather know how to output {gallery} directly from PHP in template, it would help a lot.

I will try to find answer in K2 source codes.

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

More
13 years 8 months ago #91216 by william white
Replied by william white on topic Simple Image Gallery does not work in k2
Have a look at components/com_k2/templates/default/item.php around line 481 in k2 2.4.1 or search for "Item image gallery" in earlier versions. This is where it is displayed in the item view. You will also find the code in Category_item.php i think for showing the gallery in the category view
Attachments:

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

More
13 years 2 months ago #91217 by Jock
Replied by Jock on topic Simple Image Gallery does not work in k2
I am having the same problem ... is there a fix for this?

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

More
13 years 2 months ago #91218 by Rastislav Klc
Replied by Rastislav Klc on topic Simple Image Gallery does not work in k2
Hi,

I have found some sort of workaround. It seems that extra fields are not prepared as main content. You can use following code it should work in any template file.

<?php

  echo JHTML::_('content.prepare', '{gallery}your/folder{/gallery}' );

?>

You can even output this way whole extrafield with any plugin markup.

 

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

More
13 years 2 months ago #91219 by Jock
Replied by Jock on topic Simple Image Gallery does not work in k2
Hi Rastislav,

 

Seems a bit extreme having to post PHP in the extra fields? Are you sure there is no other fix?

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

More
13 years 2 months ago #91220 by william white
Replied by william white on topic Simple Image Gallery does not work in k2
should work in any template file

I think he meant in a php file like category.php or item.php

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

More
13 years 2 months ago #91221 by Jock
Replied by Jock on topic Simple Image Gallery does not work in k2
Hi William,

 

The problem I am having is that when I try and do something like this:

 

{gallery}images/stories/test{/gallery}

 

In an extra field, it just outputs the syntax and doesn't display the gallery as it does if I enter it in the content tab editor.

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

More
13 years 2 months ago #91222 by matthew turner
Replied by matthew turner on topic Simple Image Gallery does not work in k2
I have just added the above directly into my category_item.php template file and tested.

I then made the following change (see below) to use the extrafield output to select the gallery folder path (defined as a variable by using a case break loop - which I think was from another post by William White - see above !)) - this means you only have to put the folder name into the extrafield textbox - which should be exactly as Jock wants/needs? 

It is exactly what I have been looking for but had not had time to do!

 

<?php echo JHTML::_('content.prepare', '{gallery}'.$FolderName.'{/gallery}' ); ?>

 

Nice one Rastislav for the above post !! Thank you :)

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

More
13 years 2 months ago #91223 by Jock
Replied by Jock on topic Simple Image Gallery does not work in k2
OK, I kind of see what you are doing ... does this mean you gave up on trying to get the extra fields to output as code and not static text? Why would it work when you paste in the content tab editor and then NOT in the extra field editors?

 

Also ... what if you wanted the front end user to add extra parameters, such as the following:

 

{gallery rows=1 cols=1 width=708 height=140 crop=1 labels=captions alignment=left orientation=horizontal buttons=0 links=0 counter=0 overlay=1}/imageFolder/images/{/gallery}

 

I dont think this solution will work for me

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


Powered by Kunena Forum