SRobinson Posted April 8, 2008 Share Posted April 8, 2008 Hi there, Im trying to include my own header in one of the header.tpl files ive tried the code {php} include ("/header.php"); {/php} and {php} <? include ("/header.php"); ?> {/php} The first just dosent include the header page, whilst the second breaks it and dosent allow any of the code for the whole page to be displayed! As you can see im trying to include the header.php file which is in the root (public_html) directory Regards, Scott 0 Quote Link to comment Share on other sites More sharing options...
nielsenj Posted April 8, 2008 Share Posted April 8, 2008 Just for clarification, is your WHMCS installation in your root "public_html" directory? Your "include" path is relative to your WHMCS directory. 0 Quote Link to comment Share on other sites More sharing options...
SRobinson Posted April 8, 2008 Author Share Posted April 8, 2008 Yup both header.php and WHMCS are in the root directory. ive also tried copying header.php to the template folder and using {php} include ("header.php"); {/php} but no luck there! 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted April 9, 2008 Share Posted April 9, 2008 Try: {php} include('header.php'); {/php} 0 Quote Link to comment Share on other sites More sharing options...
pacwebhosting Posted April 9, 2008 Share Posted April 9, 2008 Hi, I think you need the {literal} {/literal} tags? Not a .tpl guru but think thats what you need Paul 0 Quote Link to comment Share on other sites More sharing options...
bear Posted April 9, 2008 Share Posted April 9, 2008 Nope, BAJI26 has it correct. {LITERAL} is for script code and things of that nature. {PHP} should work for an include, and I have it working properly on mine using single quoted like his example. The path should be relative to the root WHMCS install directory. 0 Quote Link to comment Share on other sites More sharing options...
Brett Posted April 9, 2008 Share Posted April 9, 2008 No, the path should be relative to your username. It should be {php} include('/home/username/whmcs/header.php'); {/php} 0 Quote Link to comment Share on other sites More sharing options...
bear Posted April 9, 2008 Share Posted April 9, 2008 While that might be correct for traditional PHP includes, this is a special circumstance since it's using Smarty and works when called from the WHMCS root, not "user" doc root. Try it? 0 Quote Link to comment Share on other sites More sharing options...
CanDoNetwork Posted April 9, 2008 Share Posted April 9, 2008 {php} include('header.php'); {/php} Does work, I just tried it. The path is relevant to the WHMCS root. Now, My header.php file is one level up, any ideas on how to go up a level? I tried: {php} include('./menuheader.php'); {/php} but that (or similar variations) didn't work - is there a special code I need? 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted April 9, 2008 Share Posted April 9, 2008 {php} include('../header.php'); {/php} 0 Quote Link to comment Share on other sites More sharing options...
CanDoNetwork Posted April 9, 2008 Share Posted April 9, 2008 Works! Thank you. 0 Quote Link to comment Share on other sites More sharing options...
bear Posted April 10, 2008 Share Posted April 10, 2008 Again, BAJI226 has it. "./" represents "this directory", while "../" means up one...."../../" means up two and so on. 0 Quote Link to comment Share on other sites More sharing options...
pRieStaKos Posted August 7, 2012 Share Posted August 7, 2012 You can use {include_php file='/path/file.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.