View previous topic :: View next topic |
Author |
Message |
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Thu Aug 10, 2006 8:27 pm Post subject: unrecognized tag 'fun' |
|
|
Hello!
I have a strange problem. I have installed smarty (which works fine) with the defun-plugin. I get the error "unrecognized tag 'fun'". This is my smarty-Code:
Code: | <ul>
{defun name=navitree2 list=$navigation lists=1}
{foreach from=$list key=sideid item=side}
<li>
{$side.name}_{$sideid}
{if $side.side}
{assign var=lists value=$lists+1}
<ul>{fun name=navitree2 list=$side.side lists=$lists}</ul>
{/if}
</li>
{/foreach}
{/defun}
</ul> |
I have added the line "echo $plugin_file;" befor the include-line of the plugin in Smarty_Compiler.class.php in 622. The Output is
Quote: | C:\xampplite\htdocs\rh\smarty\plugins\compiler.defun.phpC:\xampplite\htdocs\rh\smarty\plugins\compiler.assign.php |
This means that the file is included. I add a "echo 'test';" in the compiler.defun.php, but is not printed. If I delete the content of the compiler.assign.php, the "test" is printed.
!?!?!?!? What's up? Someone can help me?
Thanks a lot, Markus |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Thu Aug 10, 2006 8:42 pm Post subject: |
|
|
You are using the code from here? http://me.ssju.de/compiler.defun/
Note that all that code should reside in a single file: compiler.defun.php in your plugins directory. |
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 7:30 am Post subject: |
|
|
Yes, this is done. Any other ideas? |
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 7:48 am Post subject: |
|
|
Perhaps this helps to find a solution: If a ADD a file compiler.fun.php, this error occurs: Quote: | syntax error: unrecognized tag '/defun' |
|
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 7:51 am Post subject: |
|
|
I create the smarty-object and display the template out of a function. Does this help? |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Aug 11, 2006 7:51 am Post subject: |
|
|
did you clear templates_c or set $smarty->force_compile after adding the compiler plugins? |
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 7:59 am Post subject: |
|
|
yes, no difference |
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 9:09 am Post subject: |
|
|
The problem occurs only if the smarty-object is created, and the smarty-template displayed, out of a function. If I delete the function, it works perfectly. What is the problem??
It WORKS in a function if I delete the "defun"-Section in the template. Problem with this Plugin? |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Aug 11, 2006 9:29 am Post subject: |
|
|
I think the plugin only works if you do not have more than one instance of Smarty in your script. |
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 9:31 am Post subject: |
|
|
is there no workaround? I have more than one instance and cannot do this in another way because I use many templates. |
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 9:37 am Post subject: |
|
|
I deleted the {defun}-section in the other template, but the error always occurs. This is really a problem of the function. If I delete it, it works fine. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Aug 11, 2006 9:42 am Post subject: |
|
|
restak wrote: | is there no workaround? |
sure, there is. you know this stuff came without any warrenty, do you? |
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 9:50 am Post subject: |
|
|
Yes but I can't imagine that this is difficult to work around, because it seems to be a problem with the fact that the template is create out of a function. Do you have an idea for a work around? |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Fri Aug 11, 2006 11:02 am Post subject: |
|
|
Yes I have an idea, but I also published this as a proof of concept that comes with no support and no warrenty. why don't you want to understand how this plugins works and work around it yourself? if you want to use this as a blackbox without understanding it's inner working, then you are using it in a wrong way. |
|
Back to top |
|
restak Smarty Rookie
Joined: 10 Aug 2006 Posts: 14
|
Posted: Fri Aug 11, 2006 11:08 am Post subject: |
|
|
Yes but isn't this a bug in the script itself that it does not work within a function? |
|
Back to top |
|
|