hyptonic Posted March 29, 2008 Share Posted March 29, 2008 So I searched around the forums and found many answers but none that solved my problem. I'm trying to include my outside php header and footer file in the header.tpl and footer.tpl iv tried many things but none seem to get my file included in the site. iv also tryed full paths. {php} include("site_header.php"); {/php} {include_php file="site_footer.php"} http://hyptonic.net/ampedhosts.com/clients/ ^^where my whmcs is found if anyone has any ideas that is greatly appreciated 0 Quote Link to comment Share on other sites More sharing options...
PPH Posted March 29, 2008 Share Posted March 29, 2008 http://smarty.php.net/docs.php I believe php code must be surrounded by {literal} {/literal} 0 Quote Link to comment Share on other sites More sharing options...
mylove4life Posted March 29, 2008 Share Posted March 29, 2008 {php} The {php} tags allow PHP code to be embedded directly into the template. They will not be escaped, regardless of the $php_handling setting. This is for advanced users only, not normally needed and not recommended. Technical Note: To access PHP variables in {php} blocks you will need to use the PHP global keyword. Example 7-28. php code within {php} tags {php} // including a php script directly from the template. include('/path/to/display_weather.php'); {/php} Example 7-29. {php} tags with global and assigning a variable {* this template includes a {php} block that assign's the variable $varX *} {php} global $foo, $bar; if($foo == $bar){ echo 'This will be sent to browser'; } // assign a variable to Smarty $this->assign('varX','Toffee'); {/php} {* output the variable *} <strong>{$varX}</strong> is my fav ice cream 0 Quote Link to comment Share on other sites More sharing options...
Brett Posted March 29, 2008 Share Posted March 29, 2008 The {literal} tag will output direct code into the webpage. This is handy when you are putting javascript into your templates. Have a look here - http://www.smarty.net/manual/en/language.function.literal.php 0 Quote Link to comment Share on other sites More sharing options...
hyptonic Posted March 29, 2008 Author Share Posted March 29, 2008 well iv tryed a bunch of things and it just wont put my included file on the page. Do you think i has something to do with javascript being in the file im trying to include? 0 Quote Link to comment Share on other sites More sharing options...
mylove4life Posted March 29, 2008 Share Posted March 29, 2008 it might, have u tryed to do a basic web page on it's own to see if the include will work? 0 Quote Link to comment Share on other sites More sharing options...
hyptonic Posted March 31, 2008 Author Share Posted March 31, 2008 After realizing debugging was turned off and I added $display_errors="on"; to configuration file. I ended up finding that the include was calling my external file from the template_c folder. everything is good now. Thanks for those of you who helped. 0 Quote Link to comment Share on other sites More sharing options...
Jared Posted April 16, 2010 Share Posted April 16, 2010 Freakin amazing. I searched this forum for this very answer because I built a WordPress module for this WHMCS and none of the searches showed how to include PHP. Oh well, it works, thanks. 0 Quote Link to comment Share on other sites More sharing options...
multicolormedia Posted April 23, 2010 Share Posted April 23, 2010 what wordpress module did you build for whmcs? 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.