Execute plugin from UDT

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Post Reply
tom3232
New Member
New Member
Posts: 2
Joined: Tue Apr 23, 2013 11:21 am

Execute plugin from UDT

Post by tom3232 »

Dear community,

I have got a - for me challenging - question. The following code was working properly in CMSMS 1.10, but now in version 1.11 and Smarty 3, I'm always getting an error:

Code: Select all

  $gCms = cmsms();
  $smarty = &$gCms->GetSmarty();
  $smarty_data = "{cropnewsimage target_size_x='114' target_size_y='88' feld_id='1' output='thumb_register_'}";
  $smarty->_compile_source('temporary template', $smarty_data, $_compiled );
  @ob_start();
  $smarty->_eval('?>' . $_compiled);
  $_contents = @ob_get_contents();
  @ob_end_clean();
Calling the UDT, the following error occurs:

Code: Select all

Call of unknown method '_compile_source'.
The purpose of the code is to execute a plugin from a user defined tag. I think the method "_compile_source" is deprecated in Smarty 3. Can anyone help me?
Jos
Support Guru
Support Guru
Posts: 4019
Joined: Wed Sep 05, 2007 8:03 pm

Re: Execute plugin from UDT

Post by Jos »

I think this piece of documentation can help you: http://www.smarty.net/docs/en/resources.string.tpl
User avatar
Jo Morg
Dev Team Member
Dev Team Member
Posts: 1973
Joined: Mon Jan 29, 2007 4:47 pm

Re: Execute plugin from UDT

Post by Jo Morg »

Also I believe that you can't redefine $smarty inside of the UDT as of 1.11.x CMSMS versions.
To check that just try this:

Code: Select all

  
  #$gCms = cmsms(); #<-- comment out
  #$smarty = &$gCms->GetSmarty(); #<-- comment out
  $smarty_data = "{cropnewsimage target_size_x='114' target_size_y='88' feld_id='1' output='thumb_register_'}";
  $smarty->_compile_source('temporary template', $smarty_data, $_compiled );
  @ob_start();
  $smarty->_eval('?>' . $_compiled);
  $_contents = @ob_get_contents();
  @ob_end_clean();
  $smarty_data = "{cropnewsimage target_size_x='114' target_size_y='88' feld_id='1' output='thumb_register_'}";
  $smarty->_compile_source('temporary template', $smarty_data, $_compiled );
  @ob_start();
  $smarty->_eval('?>' . $_compiled);
  $_contents = @ob_get_contents();
  @ob_end_clean();
And see if it works.
HTH
"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: Execute plugin from UDT

Post by Rolf »

- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
Post Reply

Return to “The Lounge”