Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

unrecognized tag 'fun'
Goto page 1, 2, 3  Next
 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General
View previous topic :: View next topic  
Author Message
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Thu Aug 10, 2006 8:27 pm    Post subject: unrecognized tag 'fun' Reply with quote

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
View user's profile Send private message
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Thu Aug 10, 2006 8:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 7:30 am    Post subject: Reply with quote

Yes, this is done. Any other ideas?
Back to top
View user's profile Send private message
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 7:48 am    Post subject: Reply with quote

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
View user's profile Send private message
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 7:51 am    Post subject: Reply with quote

I create the smarty-object and display the template out of a function. Does this help?
Back to top
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Aug 11, 2006 7:51 am    Post subject: Reply with quote

did you clear templates_c or set $smarty->force_compile after adding the compiler plugins?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 7:59 am    Post subject: Reply with quote

yes, no difference
Back to top
View user's profile Send private message
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 9:09 am    Post subject: Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Aug 11, 2006 9:29 am    Post subject: Reply with quote

I think the plugin only works if you do not have more than one instance of Smarty in your script.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 9:31 am    Post subject: Reply with quote

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
View user's profile Send private message
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 9:37 am    Post subject: Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Aug 11, 2006 9:42 am    Post subject: Reply with quote

restak wrote:
is there no workaround?


sure, there is. you know this stuff came without any warrenty, do you?
Back to top
View user's profile Send private message Send e-mail Visit poster's website
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 9:50 am    Post subject: Reply with quote

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
View user's profile Send private message
messju
Administrator


Joined: 16 Apr 2003
Posts: 3336
Location: Oldenburg, Germany

PostPosted: Fri Aug 11, 2006 11:02 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
restak
Smarty Rookie


Joined: 10 Aug 2006
Posts: 14

PostPosted: Fri Aug 11, 2006 11:08 am    Post subject: Reply with quote

Yes but isn't this a bug in the script itself that it does not work within a function?
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> General All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP