-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
calling fetch() within custom function not working #70
Comments
…to get output from other template like $template->fetch('foo.tpl') #70
It was originally not intended that you can call fetch() and display() on a template object with parameters to get output from another template. The correct code of your function should be
But I have added this now as a feature, Another note: |
Ok, great, thanks for the clarification! I suppose the documentation is a bit vague, which lead me to believe my code should work: "If the function needs to assign some variables to the template or use some other Smarty-provided functionality, it can use the supplied $template object to do so eg $template->foo()" (emphasis mine). Perhaps a mention that the Smarty object should be referenced with |
Merge release-2.0.7.2 into master branch
Using the following code:
with Smarty version 3.1.21, it works as expected, outputting
testing
. However, with any of the released versions after 3.1.21 including the latest 3.1.27, it generates an error:Interestingly, I tried it with the latest dev-master, and it doesn't generate an error, but it doesn't generate any output, either. So both the latest release and the dev-master are broken.
Also, it doesn't matter if the function is calling a string template or an actual file template, it generates the same error.
The text was updated successfully, but these errors were encountered: