Hostwebsite Posted July 4, 2009 Share Posted July 4, 2009 How can i use php includes in the .tpl file I want to include the header footer and sidebar. Jess 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 4, 2009 Share Posted July 4, 2009 {include file='header.tpl'} 0 Quote Link to comment Share on other sites More sharing options...
Hostwebsite Posted July 4, 2009 Author Share Posted July 4, 2009 Thanks I used {include file='../includes/header.php'} and it did not work 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 4, 2009 Share Posted July 4, 2009 Where is WHMCS installed and where is the file that you want the header, footer and sidebar to show? 0 Quote Link to comment Share on other sites More sharing options...
Hostwebsite Posted July 4, 2009 Author Share Posted July 4, 2009 http://hostwebsite.co.nz/clients http://hostwebsite.co.nz/includes/header.php sidebar.php footer.php 0 Quote Link to comment Share on other sites More sharing options...
pwner99 Posted July 4, 2009 Share Posted July 4, 2009 (edited) Try: {include file='../../includes/header.php'} Edited July 4, 2009 by pwner99 0 Quote Link to comment Share on other sites More sharing options...
bear Posted July 4, 2009 Share Posted July 4, 2009 That would be incorrect. "../" brings it up out of the 'clients' directory, where the include directory is. "../../" would fail. Have you tried using root relative? {include file='/includes/header.php'} 0 Quote Link to comment Share on other sites More sharing options...
pwner99 Posted July 4, 2009 Share Posted July 4, 2009 It works just fine for me so I suggested it, sometimes these things just work For example I have an image in mydomain.com/images/image.png, and in my html file located in mydomain.com/account/file.html I can do this just fine: <img src="../../images/image.png"> 0 Quote Link to comment Share on other sites More sharing options...
bear Posted July 4, 2009 Share Posted July 4, 2009 Directory traversal only allows for publicly accessible locations, so it goes as far as possible then can't go further. It delivers whatever it can find at that level that matches, but it won't always work using that. 0 Quote Link to comment Share on other sites More sharing options...
Hostwebsite Posted July 4, 2009 Author Share Posted July 4, 2009 That would be incorrect. "../" brings it up out of the 'clients' directory, where the include directory is. "../../" would fail. Have you tried using root relative? {include file='/includes/header.php'} What is root relative? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted July 4, 2009 Share Posted July 4, 2009 Root relative refers to document root, the main publicly viewable folder. There are three types of links: Document relative.Links are made with the calling document as the starting point. ("file.ext", "../file.ext" or "../../file.ext"). The server looks for the file starting from where the link is called. Root Relative.The server looks for the file starting at the lowest directory viewable by the public: the document root. This is done by using: "/file.ext" and signifies that the server should start looking for the file from the main folder (using cpanel, this is "/home/user/public_html"), no matter from where within the site it's referenced. Absolute link.Using the whole URI to tell where to find something, as in "http://www.example.com/folder/file.ext". This will start by the server looking for that domain, then folder then file, all externally. PHP/Apache settings might prohibit that from working as an include, however. 0 Quote Link to comment Share on other sites More sharing options...
Hostwebsite Posted July 5, 2009 Author Share Posted July 5, 2009 Root relative refers to document root, the main publicly viewable folder. There are three types of links: Document relative.Links are made with the calling document as the starting point. ("file.ext", "../file.ext" or "../../file.ext"). The server looks for the file starting from where the link is called. Root Relative.The server looks for the file starting at the lowest directory viewable by the public: the document root. This is done by using: "/file.ext" and signifies that the server should start looking for the file from the main folder (using cpanel, this is "/home/user/public_html"), no matter from where within the site it's referenced. Absolute link.Using the whole URI to tell where to find something, as in "http://www.example.com/folder/file.ext". This will start by the server looking for that domain, then folder then file, all externally. PHP/Apache settings might prohibit that from working as an include, however. {include file='http://hostwebsite.co.nz/includes/header.php'}? 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 5, 2009 Share Posted July 5, 2009 {include file='/home/user/public_html/includes/header.php'} 0 Quote Link to comment Share on other sites More sharing options...
Hostwebsite Posted July 5, 2009 Author Share Posted July 5, 2009 Now does http://hostwebsite.co.nz/clients/ cant see why 0 Quote Link to comment Share on other sites More sharing options...
bear Posted July 5, 2009 Share Posted July 5, 2009 Mainly because of these: <link rel="stylesheet" media="screen" type="text/css" href="<?=base_url()?>/includes/css/style.css" /> This doesn't appear to be defined: ?=base_url()? You also have this showing in the page's code: "include('functions.php');". That likely means it's not being parsed properly and being sent to the page as literal text. Fix this one, and it may fix the rest? You might consider hiring someone to help you through this (just don't do so on this forum, please, it's against the rules). 0 Quote Link to comment Share on other sites More sharing options...
Hostwebsite Posted July 5, 2009 Author Share Posted July 5, 2009 Mainly because of these: <link rel="stylesheet" media="screen" type="text/css" href="<?=base_url()?>/includes/css/style.css" /> This doesn't appear to be defined: ?=base_url()? You also have this showing in the page's code: "include('functions.php');". That likely means it's not being parsed properly and being sent to the page as literal text. Fix this one, and it may fix the rest? You might consider hiring someone to help you through this (just don't do so on this forum, please, it's against the rules). The base_url is defined in the functions.php document and is all working 100% except in the clients folder. Jess 0 Quote Link to comment Share on other sites More sharing options...
Hostwebsite Posted July 5, 2009 Author Share Posted July 5, 2009 I now have got it semi working http://hostwebsite.co.nz/clients/ I am not sure what width to alter to change for it being to narrow? What file would my sidebar.php file go into? 0 Quote Link to comment Share on other sites More sharing options...
bear Posted July 5, 2009 Share Posted July 5, 2009 I am not sure what width to alter to change for it being to narrow? For figuring out what to change, I'd highly recommend downloading the Firefox browser and the Firebug plugin for it, both free. It allows you to visually see the box model of the page (and change for testing in real time), and locate the element responsible for widths and so forth. Terrific tool for this. 0 Quote Link to comment Share on other sites More sharing options...
HerrZ Posted July 6, 2009 Share Posted July 6, 2009 PHP in smarty: {php} // for example php code echo $this->get_template_vars('smartyvar'); {/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.