I run a phplinkdirectory who uses smarty templates.
While I was modifying footer.tpl, I needed to include a .php file and I tried {include file="/path/to/somefile.php"} . This turned out to include it as text file, without executing it.
After some research, I found that it will execute it only if included with {include_php file="/path/to/somefile.php"}
20 comments:
perfect! thanks!
Hi,
Just for information, you can also use like the following
{php}
include("includes/myname.php"); {/php}
Sutha
http://www.biznesshut.com
Thank you very much for sharing your experience. I was struggling with this for a while until I searched google and found your site.
Thanks again.. Works like a charm
Cool thanks
Thank you!
Another thanks!
After banging my head against the monitor for several days, combing through the (sparse) smarty documentation and Googling until my fingers bled I *finally* stumbled on your note. THANKYOUTHANKYOUTHANKYOU
Your site is at the top of MY bookmark list!
You rock, works great.
good one
Thanks for the tips.
I just want to add.
that to include a variable in the parameter you need to use `
{include_php file="`$dir_path`/my_file.php"}
thanks.
Thanks a lot, really usefull.
Visit my site at http://www.sistemas7g.com
This worked for me:
{php}
include($_SERVER['DOCUMENT_ROOT'].'/includes/file.php');
{/php}
Just wanted to say thanks for this info, silly thin is it took me ages to find this out! :)
works perfect, BIG thanks and kisses :*
Thank you for posting this, i use this so often that i forget it every time in need it.
so in google i type include php smarty !
Thank you very much for this snippet of code! It saved me hours of work!
Wow I knew I was missing something...
{php} {/php}
That's what I was looking for! Thanks for sharing. =)
thanks for the help Ana! I needed something like this for the last few months. Thanks again!
thanks SOOOO much. saved me time. :D
Thanks Ana, it is really helpful to me.
Post a Comment