View previous topic :: View next topic |
Author |
Message |
strafford Smarty Rookie
Joined: 27 Jun 2018 Posts: 17
|
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
|
Back to top |
|
strafford Smarty Rookie
Joined: 27 Jun 2018 Posts: 17
|
Posted: Tue Feb 12, 2019 1:16 pm Post subject: |
|
|
AnrDaemon wrote: | Works like a charm, just as I said.
|
Yes, when calling the local one, but when you try and call the plugin you get the error.
Code: | $smarty->registerPlugin('block', 't', 'smarty_block_t'); |
Error:
Plugin 't' not callable |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Tue Feb 12, 2019 1:57 pm Post subject: |
|
|
Both works, if you did not notice.
Fetch the forum-27741 branch and run testcase yourself. |
|
Back to top |
|
strafford Smarty Rookie
Joined: 27 Jun 2018 Posts: 17
|
Posted: Tue Feb 12, 2019 2:33 pm Post subject: |
|
|
AnrDaemon wrote: | Both works, if you did not notice.
Fetch the forum-27741 branch and run testcase yourself. |
Not for me:
Code: | Fatal error: Uncaught --> Smarty: Plugin 't' not callable <-- thrown in /usr/local/php5/lib/php/Smarty/sysplugins/smarty_internal_method_registerplugin.php on line 50 |
PHP: 5.6.40
Smarty: 3.1.33 |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Wed Feb 13, 2019 3:42 pm Post subject: |
|
|
Then fix your layout or Smarty initialization.
You have a working example before you, step through it with a debugger and see how it differs from your code. |
|
Back to top |
|
strafford Smarty Rookie
Joined: 27 Jun 2018 Posts: 17
|
Posted: Wed Feb 13, 2019 9:34 pm Post subject: |
|
|
AnrDaemon wrote: | Then fix your layout or Smarty initialization.
You have a working example before you, step through it with a debugger and see how it differs from your code. |
Well it is actually working (I added all the required directories and po/mo files) and it is actually translating correctly.
BUT I still get the same error. So do you not need to register the plugins? If I comment out the registerPlugin call it works fine. How do you know when to and when not to? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Feb 14, 2019 1:07 am Post subject: |
|
|
You need to EITHER
a) load the file defining the necessary callable and register plugin
OR
b) place the specifically named file defining a specifically named callable into one of the configured Plugins directories.
NOT both.
See https://github.com/AnrDaemon/test-001/tree/forum-27741 for details. |
|
Back to top |
|
strafford Smarty Rookie
Joined: 27 Jun 2018 Posts: 17
|
Posted: Thu Feb 14, 2019 1:59 pm Post subject: |
|
|
AnrDaemon wrote: | You need to EITHER
a) load the file defining the necessary callable and register plugin
OR
b) place the specifically named file defining a specifically named callable into one of the configured Plugins directories.
NOT both.
See https://github.com/AnrDaemon/test-001/tree/forum-27741 for details. |
Ok, so if the function was NOT called smarty_block_t, then I would have to use registerPlugin(). It was not clear (at least to me) from the docs. I was thinking it had to be in a plugin dir, and then registered.
Thank you!! |
|
Back to top |
|
|