View previous topic :: View next topic |
Author |
Message |
daan.timmer Smarty Rookie
Joined: 10 Feb 2009 Posts: 9
|
Posted: Tue Feb 10, 2009 11:22 am Post subject: Can't use variable modifiers |
|
|
For somereason I cannot use any variable modifiers.
When I do something like: {$foo|escape} I get this error message:
Code: | Fatal error: Smarty error: [in zoeken.html line 59]: [plugin] modifier '|escape' is not implemented (core.load_plugins.php, line 118) in /home/m5nnl/public_html/Smarty.class.php on line 1002 |
Although I am 100% sure it is enabled/in the plugins folder
However, when I use this: {$foo|escape:'htmlall'} I get the following:
Code: | Parse error: syntax error, unexpected T_STRING, expecting ')' in /home/m5nnl/public_html/templates_c/%%60^602^602F2794%%zoeken.html.php on line 4 | Generated PHP Code: Code: | smarty_core_load_plugins(array('plugins' => array(array('modifier', '|escape:'htmlall'', 'zoeken.html', 59, false),)), $this); ?> | When I change the single to double quote I will get: Code: | Parse error: syntax error, unexpected ':' in /home/m5nnl/public_html/templates_c/%%60^602^602F2794%%zoeken.html.php on line 88 | And generated PHP: Code: | <a href="<?php echo ((is_array($_tmp=$this->_tpl_vars['resultaatje']->column1)) ? $this->_run_mod_handler('|escape:"htmlall"', true, $_tmp) : smarty_modifier_|escape:"htmlall"($_tmp)); ?> |
I havent changed anything with how smarty works or handles. I used to be able to do this on an other server but this server doesnt like it it seams >_<
Any clue on how to fix this? |
|
Back to top |
|
elpmis Smarty Elite
Joined: 07 Jun 2007 Posts: 321
|
Posted: Tue Feb 10, 2009 2:23 pm Post subject: Re: Can't use variable modifiers |
|
|
daan.timmer wrote: | For somereason I cannot use any variable modifiers.
When I do something like: {$foo|escape} I get this error message:
Code: | Fatal error: Smarty error: [in zoeken.html line 59]: [plugin] modifier '|escape' is not implemented (core.load_plugins.php, line 118) in /home/m5nnl/public_html/Smarty.class.php on line 1002 |
Although I am 100% sure it is enabled/in the plugins folder
|
You can find the correct use of escape here
http://www.smarty.net/manual/en/language.modifier.escape.php
The error message says escape modifier is not available.
Are you sure the file modifier.escape.php is valid? Some ftp programs make files corrupt on uploading.
Does other modifiers work? Is the path to plugins folder correct? |
|
Back to top |
|
daan.timmer Smarty Rookie
Joined: 10 Feb 2009 Posts: 9
|
Posted: Tue Feb 10, 2009 5:02 pm Post subject: |
|
|
No other modifiers work. I tried registering my own modifier, doesn't work either.
For some reason smarty is compiling incorrectly. It is creating a function call like this:
smarty_modifier_|escape:"htmlall"($_tmp);
However, it should compile to:
smarty_modifier_escape($_tmp,"htmlall");
(Atleast, what I can remember top of my head) |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Feb 10, 2009 5:06 pm Post subject: |
|
|
Check your plugins_dir setting, be certain it points to the plugin directory. You can test it by trying to read the file directly in PHP:
Code: | readfile($smarty->plugins_dir.'/modifier.escape.php'); |
If you get an error, something isn't setup right. |
|
Back to top |
|
daan.timmer Smarty Rookie
Joined: 10 Feb 2009 Posts: 9
|
Posted: Tue Feb 10, 2009 5:25 pm Post subject: |
|
|
That works like a charm... |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Feb 10, 2009 8:56 pm Post subject: |
|
|
You don't have something like magic_quotes enabled do you? Is the compile_dir writable? Is all of Smarty and its lib dirs installed correctly? Are there any php errors or web server errors that may help? |
|
Back to top |
|
daan.timmer Smarty Rookie
Joined: 10 Feb 2009 Posts: 9
|
Posted: Wed Feb 11, 2009 12:29 am Post subject: |
|
|
To answer your question about the magic_quotes:
Code: |
magic_quotes_gpc On On
magic_quotes_runtime Off Off
magic_quotes_sybase Off Off
|
compile?dir is writable. All Smarty libs are installed and no PHP errors (That is I have error_reporting set to E_ALL)
No webserver errors.
If I don't use any variable modifier everything goes fine. But as soon as I want to use a modifier the compile somehow fails.
No matter what modifier that is btw.
*Function s do work btw (like {CYCLE})
Also, character encoding is set to LATIN-1 (ISO-8859-1) |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Feb 11, 2009 1:06 am Post subject: |
|
|
Turn magic_quotes_gpc off. |
|
Back to top |
|
daan.timmer Smarty Rookie
Joined: 10 Feb 2009 Posts: 9
|
Posted: Wed Feb 11, 2009 9:36 am Post subject: |
|
|
They are turned off now. Still the same problem
Code: | Fatal error: Smarty error: [in header.html line 48]: [plugin] modifier '|escape' is not implemented (core.load_plugins.php, line 118) in /home/m5nnl/public_html/Smarty.class.php on line 1002 |
[edit1]
{$current_index|escape}
[edit2]
Also, if any help: I(the server) am using PHP 5.2.6
[edit3]
It seems as if the compiler doesnt 'strip' the pipe-char from the string resulting in saying it can't find |modifier
[edit4]
Another problem that I have is this: when I use {literal}{/literal} Everything between the tags will be stripped from the file.
So this:
Code: | <script type="text/javascript">
{literal}
function someJSFunction(){}
{/literal}
</script> |
Will result in:
Code: | <script type="text/javascript">
</script> |
|
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Feb 11, 2009 3:06 pm Post subject: |
|
|
There is definitely something strange here. Have you tried unpacking a vanilla install of Smarty and do a very simple test against the install? |
|
Back to top |
|
daan.timmer Smarty Rookie
Joined: 10 Feb 2009 Posts: 9
|
Posted: Wed Feb 11, 2009 3:46 pm Post subject: |
|
|
It is a fresh install.
I can try a downgrade.
[edit]
Did a fresh downgrade to 2.6.19 Same problem |
|
Back to top |
|
streetlogics Smarty n00b
Joined: 03 Mar 2009 Posts: 3
|
Posted: Tue Mar 03, 2009 10:58 pm Post subject: |
|
|
We are having the same issue here - we keep getting the error saying
Quote: | "Fatal error: Smarty error: [in view_event_media.tpl line 134]: [plugin] modifier '|strtoupper' is not implemented (core.load_plugins.php, line 118)". |
As I understand it, all PHP functions should be implemented.
Digging through the code, in core.load_plugins.php on line 99, this is where the message is being set, and it's being set from the call:
Code: |
if (! function_exists ( $_name )) {
$_message = "modifier '$_name' is not implemented";
}
|
Going through this logically, if I enter a PHP function name, it should ALWAYS return true for function_exists - since this is not the case, I believe the problem to be as stated by the previous member that it's looking for a function named "|strtolower" instead of the correct "strtolower" (no pipe).
I tried adding a quick "$_name = str_replace("|","",$_name);", but this just caused weird stuff to happen and didn't actually force the function to execute. This is getting so frustrating - all I want to do is use some PHP functions that the SMARTY docs say should work. |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Mar 03, 2009 11:12 pm Post subject: |
|
|
Does a vanilla install of Smarty work with a simple test case? Just {$foo|escape} in a template? |
|
Back to top |
|
daan.timmer Smarty Rookie
Joined: 10 Feb 2009 Posts: 9
|
Posted: Tue Mar 03, 2009 11:26 pm Post subject: |
|
|
Nopes, at least, it didnt on my server. How ever on the exact same server, different domain, everything DOES work.
I compared (using a real compare tool) the two phpinfo()'s and they are identical (except for domain names)
So I guess it is something server related, but what? IDK. Both servers are also set-up in the same way. I just copy-pasted the whole project from one domain to the other and on that one it did work... On the other it stilld oesnt... |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Mar 03, 2009 11:27 pm Post subject: |
|
|
Did you compare the compiled templates between the two platforms? Are the PHP versions the same? Is magic quotes enabled in any way?
OS and PHP versions?
Last edited by mohrt on Tue Mar 03, 2009 11:29 pm; edited 1 time in total |
|
Back to top |
|
|