DataHosts Posted August 28, 2008 Share Posted August 28, 2008 Ok...I am at a loss here as I have tried everything, but to no success. I am trying to include a PHP file to be called on each page of WHMCS. I have review Smarty, the forum, and even googled.....but each time I try it does not work. I have tried the following: File located outside WHMCS directory: {php} include "http://www.domain.com/include/file.php"; {/php} File located outside WHMCS directory: {php} include "http://whmcs.domain.com/templates/{tempate}/file.php"; {/php} Path: {php} include_file="/home/{uname}/public_html/whmcs/file.php"; {/php} Path: {php} include_file='/home/{uname}/public_html/whmcs/file.php'; {/php} Now I am just banging my head and I am tired. So, any assitance would be great as I know I am overlooking the obvious...but another set of eyes (brains) is better than 1 anyday. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 28, 2008 Share Posted August 28, 2008 Forget about the {php}...{/php} tags. (Smarty try to discourage its use) Try {* for absolute filepath *}{include file='/usr/local/include/templates/header.tpl'} {* for absolute filepath (same thing) *} {include file='file:/usr/local/include/templates/header.tpl'} {* for windows absolute filepath (MUST use "file:" prefix) *} {include file='file:C:/www/pub/templates/header.tpl'} {* for include from template resource named "db" *} {include file='db:header.tpl'} {* for include a $variable template - eg $module = 'contacts' *} {include file="$module.tpl"} {* wont work as its single quotes ie no variable substitution *} {include file='$module.tpl'} {* for include a multi $variable template - eg amber/links.view.tpl *} {include file="$style_dir/$module.$view.tpl"} 0 Quote Link to comment Share on other sites More sharing options...
vT16 Posted September 25, 2008 Share Posted September 25, 2008 I have the same problem.. The solution you provided above is only usable for existing TPL files. This is a PHP file... Thanks, 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 25, 2008 Share Posted September 25, 2008 OK in a straight php file its a little different here is an example of some code that I use for an include eg.. The main php file is in the admin directory so this line tells where the file is to include (relative to the directory that the script started in (admin) it goes back 1 directory then into the modules/admin/template_editor directory $configfile = '../modules/admin/template_editor/teconfig.php';Now the includeIf the file exists then include it if (file_exists($configfile)) include($configfile);If you don't want to check if the file exists useinclude($configfile);I hope that helps youCheers 0 Quote Link to comment Share on other sites More sharing options...
herpherp Posted September 25, 2008 Share Posted September 25, 2008 {include_php file="/home/[b]Your-hosting-username/public_html/folder-name-IF-not-in-root/filename.php"} 0 Quote Link to comment Share on other sites More sharing options...
DataHosts Posted September 25, 2008 Author Share Posted September 25, 2008 Either I am putting it in the wrong place, blind, or stupid... I still am unable to get it to work right 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 25, 2008 Share Posted September 25, 2008 Either I am putting it in the wrong place, blind, or stupid... I still am unable to get it to work right I will take a look at it if you like. PM me... 0 Quote Link to comment Share on other sites More sharing options...
DataHosts Posted September 25, 2008 Author Share Posted September 25, 2008 Thanks for the offer...PM sent with details 0 Quote Link to comment Share on other sites More sharing options...
vT16 Posted September 27, 2008 Share Posted September 27, 2008 {php} include('/home/username/public_html/pages/header.php'); {/php} This solution worked just fine for me. Try it out 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted September 27, 2008 Share Posted September 27, 2008 @vT16: Problem solved last night and yes your example will work also in your example you could use {php} include('pages/header.php'); {/php}or in smarty{include_php file="pages/header.php"} 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.