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"}
perfect! thanks!
ReplyDeleteHi,
ReplyDeleteJust 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.
ReplyDeleteThanks again.. Works like a charm
Cool thanks
ReplyDeleteThank you!
ReplyDeleteAnother thanks!
ReplyDeleteAfter 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
ReplyDeleteYour site is at the top of MY bookmark list!
You rock, works great.
ReplyDeletegood one
ReplyDeleteThanks for the tips.
ReplyDeleteI 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.
ReplyDeleteVisit my site at http://www.sistemas7g.com
This worked for me:
ReplyDelete{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! :)
ReplyDeleteworks perfect, BIG thanks and kisses :*
ReplyDeleteThank you for posting this, i use this so often that i forget it every time in need it.
ReplyDeleteso in google i type include php smarty !
Thank you very much for this snippet of code! It saved me hours of work!
ReplyDeleteWow I knew I was missing something...
ReplyDelete{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!
ReplyDeletethanks SOOOO much. saved me time. :D
ReplyDeleteThanks Ana, it is really helpful to me.
ReplyDelete