leon_nerd Posted July 3, 2009 Share Posted July 3, 2009 Hi, I wanted to know if we can use the tpl variables in a .php file? I want to get clientdetails and clientstats on a .php page. How can I access them? The other question is more of a clarification. When we want to use a .tpl file in a php file then we use the display(tplfile) command. Am I right? If yes, then are all the smarty variables accessible to this tplfile? If I create a tpl file and use $clientsdetails.firstname in it will it work? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
Chance Posted July 20, 2009 Share Posted July 20, 2009 The Smarty templating system uses two unique files for each page to be rendered. One is the php file, which contains all the core programming logic, including the creation of the variables needed for the specific page. The second file is the tpl file used to display the page. The tpl file contains the layout of the page and it can access the variables defined in the corresponding php file. The php processor has no knowledge of the Smarty syntax, only the Smarty processor does. If you put {$variablename} in a php file, it will result in the literal display, not the actual contents of the variable. To use the display('templatefile') syntax, you must make certain that your php file that includes the display('templatefile') invocation has defined all the variables needed by the template file. And your php file must be defined as the example shown at: http://wiki.whmcs.com/Creating_Pages Hope this helps. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.