my problem with Smarty (modifiers not found, etc)
| From: | Alexander Plakidin | Date: | Wed, 15 May 2002 10:23:10 +0000 |
| Subject: | my problem with Smarty (modifiers not found, etc) | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-4197@lists.php.net to get a copy of this message | ||
Hey guys,
I have been unsubscribed from this list for a long time (don't have time to read
all the posts), but today I met some problem I decided I would like to share
with you...
OK, I have PHP 4.1.1, and latest Smarty. For some reason (yet not determined, I
tried to!) my scripts on web site I am working on stopped working properly
giving errors "modifier 'htmlspecialchars' is not implemented", "function
'html_options' is not implemented", etc. Here's how I use htmlspecialchars
modifier:
<input value="{$form_data.form_field|htmlspecialchars}">
E.g. I use standard PHP function.
I was wondering, WHY this happens. It was no easy solution, I tried for a hour
or so, - then I had to dig into smarty.class.php to solve the problem for
myself. OK, there I found function definition _load_plugins() - I had to fix
something in it to make my scripts work! I found out that my problem was in this
line:
$plugin = &$this->_plugins[$type][$name] - let's remember it as (1).
Next conditional: if (isset($plugin)) - ALWAYS worked. That's because (1) did
SET the value in hash array. E.g. $_plugins[$type][$name] was set to something.
Then, !function_exists($plugin[0]) was executed and I got "$type '$name' is not
implemented" error message! I had to change (1) to:
have_plugin = isset($this->_plugins[$type][$name]);
if($have_plugin) $plugin = &$this->_plugins[$type][$name];
And that condition below I changed to:
if ($have_plugin && $plugin[0]!="") {
Do you have any ideas of why did this happen? What could I do wrong? Or, is it a
Smarty or PHP bug? I didn't have a chance yet to investigate this thoroughly,
probably you have a quick answer. Any answer from you, guys, will be
appreciated.
What is interesting, at home I have PHP 4.1.0 (under Windows) and I don't have
this problem!
Thanks,
Alex.