peak Posted June 25, 2008 Share Posted June 25, 2008 I am attempting to include a template file into an existing .tpl file. I want to add a navigation on the side of a.tpl page that is a file call side-nav-login.tpl. I want to edit my side navigation in only 1 file, as opposed to on each of the many template pages, and I want to make use of the smarty shortcuts. I have tried, as per smarty's suggestion, and it doesn't work. I have also tried the full url, which also doesn't work. {include file='side-nav-login.tpl'} and I have also included a new php file that contained the file side-nav-login.tpl, but the php file showed the header and footer also, instead of just showing the template content. So I either want to reference a tpl file inside another tpl file, or get the php file to rid itself of the header and footer and only show the contents side-nav-login.tpl file. thanks in advance for any suggestions. 0 Quote Link to comment Share on other sites More sharing options...
chickendippers Posted June 26, 2008 Share Posted June 26, 2008 {include file="/path/to/WHMCS/templates/mytemplate.tpl"} Works fine for us. 0 Quote Link to comment Share on other sites More sharing options...
peak Posted June 26, 2008 Author Share Posted June 26, 2008 I thought I mentioned in my inital posting that I tried just that "I have tried, as per smarty's suggestion, and it doesn't work. I have also tried the full url, which also doesn't work. {include file='side-nav-login.tpl'}" and it didn't work, but thank you! 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted June 27, 2008 Share Posted June 27, 2008 You can try to include the page title: {if $pagetitle == 'support'} menu here {/if} I did it to show different stuff on different pages. 0 Quote Link to comment Share on other sites More sharing options...
peak Posted June 27, 2008 Author Share Posted June 27, 2008 That's definitely a solution, but my main goal was to have one external navigation file that I edited, in lieu of having to edit all the files! I also wanted to have an external file that would make use of the smarty variables. 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted June 28, 2008 Share Posted June 28, 2008 Just a thought... 1. Make a tpl called navagtion.tpl where you would have your navigation. 2. In this file you would add all the for all the pages {if $pagetitle == 'Shopping Cart' || $pagetitle == 'Order' || etc..}Navi Code Here {/if} 3. Delete the default WHMCS menu and add use {include file='path/to/[color=red]navigation.tpl[/color]'} Would this work?!! 0 Quote Link to comment Share on other sites More sharing options...
peak Posted June 28, 2008 Author Share Posted June 28, 2008 I just can't get the include to work with the .tpl, if I could, that woudl be great!! For some reason, my site just will not recognize "{include file='path/to/navigation.tpl'}" I have tried every path combo, single quotes, double quotes...but nothing is recognized once the site is uploaded, and I am not sure why it seems to work for everyone else!!! I have gotten the php include to work, but the .tpl doesn't!! 0 Quote Link to comment Share on other sites More sharing options...
keliix06 Posted June 29, 2008 Share Posted June 29, 2008 When you say you are trying the full URL, I'm assuming you're talking file='http://www.site.com/template.tpl'? It should be file='/home/whatever/public_html/template.tpl' (assuming you're on cPanel). 0 Quote Link to comment Share on other sites More sharing options...
peak Posted June 30, 2008 Author Share Posted June 30, 2008 you are correct, I wasn't adding that path, but it didn't work either!!! I tried all combinations of this {include file='/home/jazinta/public_html/billing/whmcs/templates/side-nav-login.tpl'} with single quotes, double quotes, adding backslashes, removing backslashes, nothing will yield a result! can anyone see what I am doing incorrectly? 0 Quote Link to comment Share on other sites More sharing options...
peak Posted July 1, 2008 Author Share Posted July 1, 2008 FYI!!! This is the syntax that finally yielded results!! YAY!!!! {include file='file:/home/jazinta/public_html/billing/whmcs/templates/default/side-nav-login.tpl'} The key is apparently the " file='file: " part of that equation. 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 2, 2008 Share Posted July 2, 2008 you are correct, I wasn't adding that path, but it didn't work either!!! I tried all combinations of this {include file='/home/jazinta/public_html/billing/whmcs/templates/side-nav-login.tpl'} with single quotes, double quotes, adding backslashes, removing backslashes, nothing will yield a result! can anyone see what I am doing incorrectly? {include file='whmc/navigation.tpl'} Don't use the full server path. 0 Quote Link to comment Share on other sites More sharing options...
Zorro67 Posted August 25, 2008 Share Posted August 25, 2008 Hi, just thought I'd add a little to this. the syntax i used was {include file='<template name without the brackets>/<menu>.tpl'}, which worked fine. I was having speed problems with page transitions on my site. So implemented the above and seems to have dealt with the page loading delays (only .5 second but every bit helps). Now each page doesn't look like it complete reloads. Cheers 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 25, 2008 Share Posted August 25, 2008 FYI!!! This is the syntax that finally yielded results!! YAY!!!! {include file='file:/home/jazinta/public_html/billing/whmcs/templates/default/side-nav-login.tpl'} The key is apparently the " file='file: " part of that equation. Yes that's correct for an absolute path. For it to work the other way the path is relative to the Smarty root (WHMCS root) so {include file='/templates/default/side-nav-login.tpl'} should work also. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted August 28, 2008 Share Posted August 28, 2008 Thought I had better correct this. In your case you can either use the full path with file='file: but try not to use the full path. Files included in a .tpl file is relative to the whmcs/templates directory so the correct way is: {include file='default/side-nav-login.tpl'} This from the Smarty Manual ResourcesThe templates may come from a variety of sources. When you display() or fetch() a template, or when you include a template from within another template, you supply a resource type, followed by the appropriate path and template name. If a resource is not explicitly given the value of $default_resource_type is assumed. Templates from $template_dir Templates from the $template_dir do not require a template resource, although you can use the file: resource for consistancy. Just supply the path to the template you want to use relative to the $template_dir root directory. Sorry for the incorrect info the first time. 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.