|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
mosuin Smarty n00b
Joined: 08 Jul 2011 Posts: 2
|
Posted: Fri Jul 08, 2011 10:19 pm Post subject: Smarty3 Compiler plugin not wrapping output in php tags |
|
|
Here is a sample compiler plugin I am trying.
Code: |
function smarty_compiler_hello($contents, &$smarty)
{
return "echo 'hello world';";
}
|
As per manual this plugin should generate below code in compiled template
Code: |
<?php
echo 'hello world';
?>
|
But my output is generated without php tags. ie like
Code: |
echo 'hello world';
|
I found that if I wrap return value with php tags in the plugin then it is working.
For example the below code is working fine.
Code: |
return "<?php echo 'hello world'; ?>";
|
I am little confused.
Should I wrap compiler output in php tags myself or smarty will take care of it?
Any help will be appreciated. |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Sun Jul 10, 2011 12:04 am Post subject: |
|
|
It's a bug in Smarty3 documentation.
The php tags must be returned by the compiler plugins. |
|
Back to top |
|
mosuin Smarty n00b
Joined: 08 Jul 2011 Posts: 2
|
Posted: Sun Jul 10, 2011 4:50 am Post subject: |
|
|
Thank you. I thought the same.
So this is the right code:
Code: |
return "<?php echo 'hello world'; ?>";
|
|
|
Back to top |
|
|
|
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
|