hey there. how can i include an external php scripts ( with +10 php files ) in smarty template engine ? i know that i can use {php} include("blah.php"); {/php} but there are many other files included in blah.php itself.. and smarty Can't load them. what is the easiest way to do that? thanks
The PHP code should be separated from the Smarty logic. You shouldn't do it the way you're trying to do it... Use Smarty includes {include file="file.tpl"} - And make sure you edit your "blah.php" file to work with Smarty.
Can you explain me little bit more ? what should i include in file.tpl for example? Pm me on msn if its possible i need this badly
Sorry, I don't give private support over MSN or PM. As for the question, I can't answer it properly without seeing the content. The PHP code should be in the .php files. And the whole layout should go in the .tpl file. I suggest you should not use Smarty if you don't know its purpose. (No offence). But you should check their website to read about it. http://smarty.php.net
I agree with nico_swd. If you don't know the real purpose of Smarty, I don't suggest that you use it. You should not have any PHP in the tpl files (It pretty much defeats the purpose).
The basic flow for Smarty (or any template engine - or really just any good separation of logic/output) is that you do all your logic and processing in one place and then store all the info you need for output into variables which you pass to the template. The template does no logic just output processing. So if you're trying to put any database/file access or business logic into your template you're doing it wrong. One kind of sticking point for people new to templating is that there is some display logic in the template. Things like looping over an array to output a number of rows in a table or things like "only display this link if they're logged in" are part of the display logic and properly belong in the template.