Keyword

Simple Image Gallery does not work in k2

  • Rafael Bonce
  • Rafael Bonce's Avatar Topic Author
  • Offline
  • New Member
More
14 years 5 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
14 years 3 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
14 years 3 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 10 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 10 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 10 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 10 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 10 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 10 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 10 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.

More
13 years 10 months ago #91224 by matthew turner
Replied by matthew turner on topic Simple Image Gallery does not work in k2
Hi Jock,

I think you could do this various ways - I don't have the gallery plugin that you are using to test...

 

try using 2 extrafields - 1 for the plugin defines (rows=1 cols=1 width=708 etc) and 2nd one for the folder path bit

which would be something like :

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

 

I have just tested using the JoomlaWorks Gallery Pro plugin and the single extrafield did it for me using this as a test in the items extrafield :
food:50:24:0:1

 

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

More
13 years 10 months ago #91225 by matthew turner
Replied by matthew turner on topic Simple Image Gallery does not work in k2
Hi Jock

I have just tried this another way using just the one extrafield which works!I used the following simpler code:

<?php echo JHTML::_('content.prepare', $mygallery2 ); ?>

 

You can then enter the complete plugin code including plugin overides into the extrafield box (rows=1 cols=1 etc)

For testing I used this in an extrafield text box {gallery}food{/gallery} mat said:

Hi Jock,

I think you could do this various ways - I don't have the gallery plugin that you are using to test...

 

try using 2 extrafields - 1 for the plugin defines (rows=1 cols=1 width=708 etc) and 2nd one for the folder path bit

which would be something like :

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

 

I have just tested using the JoomlaWorks Gallery Pro plugin and the single extrafield did it for me using this as a test in the items extrafield :
food:50:24:0:1

 

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

More
13 years 10 months ago #91226 by Jock
Replied by Jock on topic Simple Image Gallery does not work in k2
I Mat ... I appreciate your input.

 

Does this mean that there is no way you can change the K2 php code to get it to work with this kind of syntax. I struggle to understand why it works in the content editor but not in the extra fields? I would really rather avoid any such hacks ^

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

More
13 years 10 months ago #91227 by matthew turner
Replied by matthew turner on topic Simple Image Gallery does not work in k2
Hi Jock,

As explained above by Rastislav and elsewhere - that is the way Joomla works, rightly or wrongly....

Joomla or K2 Plugins are specifically setup to be "run" only when inside intro content or main content areas.

The above code changes do work (at the top of my last post), but should be made to your K2 template over ride files so that no core files are over riden/hacked.

 

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

More
13 years 10 months ago #91228 by Jock
Replied by Jock on topic Simple Image Gallery does not work in k2
You say that but why then does it work in the content tab?

 

If I place the following code in the content tab it works, place it in an extra field and it does not ... surely there is something fundamentally different in these segments of code which could be applied to the extra field to make it work like the content area does?

 

I just don't think the hack above is going to work for me and im amazed that the extra fields are not configurable this way.

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

More
13 years 10 months ago #91229 by matthew turner
Replied by matthew turner on topic Simple Image Gallery does not work in k2
Hi Jock,

Not sure why, maybe server overheads, too many differences between plugin developers etc.- a question for the Joomla team I think !

In K2 the "Content tab" is the "intro content" and "main content" area which is why the plugins work there...

The code examples that I have written/edited for you have all been added and tested to fresh installs before I posted them, they do all work.

I am looking through my plug in collection to see if I have the one you are using to test....

 

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

More
13 years 10 months ago #91230 by Jock
Replied by Jock on topic Simple Image Gallery does not work in k2
Out of interest I found this:

 

community.getk2.org/forum/topics/adding-html-code-into-extra?id=3536014%3ATopic%3A30464&page=1#comments

 

I cant seem to get it to work for me but it makes me think that there is a way to hack the php, what are your thoughts Mat?

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

More
13 years 10 months ago #91231 by matthew turner
Replied by matthew turner on topic Simple Image Gallery does not work in k2
Hi Jock,

Yes I have already read that one along my journey getting the plug ins to work in the extra fields..

The downside of that approach (editing the core K2 files) and my main reason for not using it is that any future K2 updates could/will overwrite your hacks - and you would have to re add them again :(   and k2.5 is just round the corner...

However by using template over rides in your template folder, you can change how K2 displays/operates and not lose these changes when updating :)

Also because the over rides are in your template folder you can just delete them and K2 will be back to default again !

What is the name of the gallery plugin you are trying to use ?

 

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

More
13 years 10 months ago #91232 by Jock
Replied by Jock on topic Simple Image Gallery does not work in k2
It's this one here:

 

hunyadi.info.hu/en/projects/sigplus

 

Works well, but just not in extrafields!

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

More
13 years 10 months ago #91233 by matthew turner
Replied by matthew turner on topic Simple Image Gallery does not work in k2
Hi Jock,

Yes that works in extrafields using the template over ride code i previously posted... !!

Nice gallery, not seen it before - thanks.

Plug in code I entered into a "Text Field" extra field which worked:

{gallery rows=3 cols=1 width=200 height=140 crop=1 labels=captions alignment=left orientation=horizontal buttons=0 links=0 counter=0 overlay=1}food/{/gallery}

 

I even have loadposition plugin running using the same code, and Joomlaworks Gallery pro plugin at the same time...

If this is for users to fill in you could re write the code where several extrafields make up the "whole" plugin string...?

And at the same time keep overall control of the layout / plug in over rides that you want eg pop up engine/light box used?

The options are limitless once you assign the extrafields to variables....

Extra images..

Mp3s...

Email links...

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


Powered by Kunena Forum