How to call a Gallery smarty tag from a UDT?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
rogerlatur
New Member
New Member
Posts: 7
Joined: Sat Aug 02, 2014 2:53 pm

How to call a Gallery smarty tag from a UDT?

Post by rogerlatur »

I am trying to call this Smarty tag
{Gallery dir='Content_images' img='66'}
from a UDT, without success.

I've seen this example, but it does not work.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by Jo Morg »

What are you trying to achieve?
Although possible, and in some situations the only solution to get an specific result, it's not recommended to use it if there are alternatives...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: How to call a Gallery smarty tag from a UDT?

Post by Rolf »

rogerlatur wrote:I've seen this example, but it does not work.
Yes, it does! ;)
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
rogerlatur
New Member
New Member
Posts: 7
Joined: Sat Aug 02, 2014 2:53 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by rogerlatur »

Jo Morg wrote:What are you trying to achieve?
Although possible, and in some situations the only solution to get an specific result, it's not recommended to use it if there are alternatives...
This tag is cool cause it adds an image and takes all lytebox parameters too (opens in a new window on click etc etc):

Code: Select all

{Gallery dir='Content_images' img='66'} 
Now I'd like to be able to add 2 images, centered on the page (with a little distance between both, but that's a detail). To do so I'm actually adding UDTs before, between, after!

Code: Select all

{image_left_center_open}{Gallery dir='Content_images' img='47'}{image_right_center_open}{Gallery dir='Content_images' img='27'}{image_right_center_close}
Very dirty method IMO, mostly for the use who's gone use cmms!!!

As I don't know where is the php to edit directly what the smarty tag "Gallery" does (I asked here but my question was never displayed), I thought I'd ask how to manipulate a tag in a tag!

I think it's much better if I can modify the php itself, but could not find it :)
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by Jos »

Maybe it is the call itself. It makes no sense to have the parameters dir and img at the same time.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by Jo Morg »

rogerlatur wrote:As I don't know where is the php to edit directly what the smarty tag "Gallery" does (I asked here but my question was never displayed), I thought I'd ask how to manipulate a tag in a tag!
The question implied hacking the module so it violated the forum rules...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by Jos »

I remember somebody asked in which file parameters are defined.
Was that you?
I don't agree that just asking where a file can be found, is a violation of forum rules :-X
http://forum.cmsmadesimple.org/viewtopi ... 40&t=28132
But it wouldn't have helped you anyway.
Now I'd like to be able to add 2 images, centered on the page (with a little distance between both, but that's a detail). To do so I'm actually adding UDTs before, between, after!
The proper way would be to create a subgallery, upload the two images, assign the gallery-template of your choice. You can create/copy a gallery-template and edit the css to get the extra space (margin).
In your content page you have nothing else to do than call the subgallery with {Gallery dir='yoursubgallery'}
Last edited by Jos on Mon Aug 04, 2014 11:50 am, edited 1 time in total.
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by Jo Morg »

Jos wrote:I don't agree that just asking where a file can be found, is a violation of forum rules :-X
viewtopic.php?f=40&t=28132
But it wouldn't have helped you anyway.
I was just guessing by this statment:
rogerlatur wrote:As I don't know where is the php to edit directly what the smarty tag "Gallery" does (I asked here but my question was never displayed)
It wasn't me who moderated the post anyway so I don't really know about what was written on the deleted post other then by this statement. :)
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
rogerlatur
New Member
New Member
Posts: 7
Joined: Sat Aug 02, 2014 2:53 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by rogerlatur »

It would be the first time for me that modifying an open source php file is considered as a hacking fact!
As long as you don't use it commercially, keep all copyrights, headers etc, I really don't see what would be wrong in doing this.
Imagine if nobody was able to modify anything, then the open source world would be dead since a long time.
rogerlatur
New Member
New Member
Posts: 7
Joined: Sat Aug 02, 2014 2:53 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by rogerlatur »

Jo Morg wrote:
rogerlatur wrote:As I don't know where is the php to edit directly what the smarty tag "Gallery" does (I asked here but my question was never displayed), I thought I'd ask how to manipulate a tag in a tag!
The question implied hacking the module so it violated the forum rules...
Now I see that I got the reason why my post was deleted.
I thought you were jocking. It seems that you are not. Only pathetic.
rogerlatur
New Member
New Member
Posts: 7
Joined: Sat Aug 02, 2014 2:53 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by rogerlatur »

I found the file.

Just that you know.:

Code: Select all

# This program is free software; [b]you can redistribute it and/or modify
# it under the terms of the GNU General Public License[/b] as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
rogerlatur
New Member
New Member
Posts: 7
Joined: Sat Aug 02, 2014 2:53 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by rogerlatur »

Rolf wrote:
rogerlatur wrote:I've seen this example, but it does not work.
Yes, it does! ;)
I tried with this:

Code: Select all

$smarty = cmsms()->GetSmarty();
$smarty_data = "{Gallery}";
echo $smarty->display($smarty_data);
and I get only errors.

Code: Select all

httpdocs/lib/smarty/Smarty.class.php:1593 - trigger_error
/httpdocs/lib/smarty/Smarty.class.php:1415 - _fetch_resource_info
/httpdocs/lib/smarty/Smarty.class.php:1254 - _compile_resource
/httpdocs/lib/smarty/Smarty.class.php:1106 - fetch
/httpdocs/lib/classes/class.usertagoperations.inc.php(260) : eval()'d code:8 - display
etc etc
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1978
Joined: Mon Jan 29, 2007 4:47 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by Jo Morg »

rogerlatur wrote:Now I see that I got the reason why my post was deleted.
I thought you were jocking. It seems that you are not. Only pathetic.
I do hope I'm misinterpreting this...

rogerlatur wrote:I found the file.

Just that you know.:

Code: Select all

# This program is free software; [b]you can redistribute it and/or modify
# it under the terms of the GNU General Public License[/b] as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
You can modify it all you want, but the rules are there for a reason: if you know what you are doing fine; if you don't, and the module stops working you most likely won't get support here. Others may apply the hack blindly and it may create more troubles that the ones it was eventually trying to solve;

In conclusion: you can modify the module files; you can't post those modifications on the forum as they will be considered a hack and a violation of the forum rules;


I hope you do understand and, in the future, avoid labeling any of the members of this community...
"There are 10 types of people in this world, those who understand binary... and those who don't."
* by the way: English is NOT my native language (sorry for any mistakes...).
Code of Condut | CMSMS Docs | Help Support CMSMS
My developer Page on the Forge
GeekMoot 2015 in Ghent, Belgium: I was there!
GeekMoot 2016 in Leicester, UK: I was there!
DevMoot 2023 in Cynwyd, Wales: I was there!
Jos
Support Guru
Support Guru
Posts: 4020
Joined: Wed Sep 05, 2007 8:03 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by Jos »

Rolf's UDT works fine like this

Code: Select all

$img = isset($params['img']) ? $params['img'] : '';
$smarty_data = "{Gallery img='".$img."'}";
$smarty->display('eval:'.$smarty_data);
But I'd rather like to refer to the solution provided in my former post
rogerlatur
New Member
New Member
Posts: 7
Joined: Sat Aug 02, 2014 2:53 pm

Re: How to call a Gallery smarty tag from a UDT?

Post by rogerlatur »

Jos wrote:Rolf's UDT works fine like this

Code: Select all

$img = isset($params['img']) ? $params['img'] : '';
$smarty_data = "{Gallery img='".$img."'}";
$smarty->display('eval:'.$smarty_data);
No matter how I call it, with 'echo' or not, I always have the errors listed above.
Maybe because I run version 1.10.3.
I tried yesterday to upgrade CMSMS and it turned to a real nightmare !
All UDTs broken etc etc.
First time ever I have an issue ugrading/updating a CMS. I guess I am getting old.
Jos wrote:But I'd rather like to refer to the solution provided in my former post
I agree. Thank you very much for the help.
Post Reply

Return to “Modules/Add-Ons”