thehost5968 Posted July 9, 2009 Share Posted July 9, 2009 Hi How can I get this code working as all it is doing is showing this: .tpl'} there is the code I am using: {include_php file='templates/orderforms/cart/footer/{$productgroup.name}.tpl'} and I have : hello this workes in the file it is calling. So what am I doing rong. 0 Quote Link to comment Share on other sites More sharing options...
angelcosta Posted July 9, 2009 Share Posted July 9, 2009 Hi, I had this problem a while ago, you should inform only folders bellow template folder as in: {include file="portal/header.tpl"} 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 9, 2009 Author Share Posted July 9, 2009 No that did not work what it is the file name I am calling is lets say hosting.tpl as this is the product group name in the cart so the is how I needed to call the file name {$productgroup.name}.tpl and it is this that is not working right. 0 Quote Link to comment Share on other sites More sharing options...
angelcosta Posted July 9, 2009 Share Posted July 9, 2009 ok, i need to understand what you're trying to do. Do you want to include a tpl into a whmcs template page? Wanna show a link to your whmcs so i can understand it? 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 9, 2009 Author Share Posted July 9, 2009 I am trying to include some text from a tpl file at the bottom of the products.tpl (cart.php) content area but it is deppent on the product group that is being used. and using the smart code like this {$productgroup.name}.tpl should give the file name productgroupname.tpl. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted July 10, 2009 Share Posted July 10, 2009 How can I get this code working as all it is doing is showing this: Try this... you dont use curley brackets within curley brackets {include_php file='templates/orderforms/cart/footer/$productgroup.name.tpl'} 0 Quote Link to comment Share on other sites More sharing options...
C Powell Posted July 10, 2009 Share Posted July 10, 2009 try including full path like for example {include_php file='/home/USER-NAME/public_html/templates/orderforms/cart/footer/$productgroup.name.tpl'} you may need to replace home and public_html. you will need to replace USER-NAME with your own 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 10, 2009 Author Share Posted July 10, 2009 Nop nether work's but if I use this : {include file='/home/kitchen2/public_html/templates/orderforms/cart/footer/productgroupname.tpl'} It works but not when it is like: {include file='/home/kitchen2/public_html/templates/orderforms/cart/footer/$productgroup.name.tpl'} and Yes the group name has got a making named .tpl file. 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 10, 2009 Author Share Posted July 10, 2009 Here is the code I have in my cart/products.tpl <link rel="stylesheet" type="text/css" href="templates/orderforms/cart/style.css" /><br /> <p align="center" class="cartheading">{if $loggedin}<a href="{$smarty.server.PHP_SELF}?gid=addons">{$LANG.cartproductaddons}</a> | {/if} {if $registerdomainenabled}<a href="{$smarty.server.PHP_SELF}?a=add&domain=register">{$LANG.registerdomain}</a> | {/if} {if $transferdomainenabled}<a href="{$smarty.server.PHP_SELF}?a=add&domain=transfer">{$LANG.transferdomain}</a> | {/if} <a href="{$smarty.server.PHP_SELF}?a=view">{$LANG.viewcart}</a> </p> {if !$loggedin && $currencies} <form method="post" action="cart.php?gid={$smarty.get.gid}"> <p align="right">{$LANG.choosecurrency}: <select name="currency" onchange="submit()">{foreach from=$currencies item=curr} <option value="{$curr.id}"{if $curr.id eq $currency.id} selected{/if}>{$curr.code}</option> {/foreach}</select> <input type="submit" value="{$LANG.go}" /></p> </form> {/if} <br /> <h2><strong> {foreach key=num item=productgroup from=$productgroups}{if $gid eq $productgroup.gid}{$productgroup.name}{/if}{/foreach} </strong></h2> <table width="95%" border="0" cellpadding="10" cellspacing="0"> <tr> <td> {include_php file='templates/orderforms/cart/header/$productgroup.name.tpl'} </td> </tr> </table> <br /> <table class="data" width="95%" border="0" cellpadding="10" cellspacing="0"> <tr> <th width="55%">Product Name / Description</th> <th width="35%" align="left">Price Per Month</th> <th width="10%"> </th> </tr> {foreach key=num item=product from=$products} <tr class="pricing"> <td width="55%"> <strong>{$product.name}</strong><br /> {$product.description} </td> <td width="35%"> {if $product.paytype eq "free"} {$LANG.orderfree} {elseif $product.paytype eq "onetime"} {$product.pricing.onetime} {$LANG.orderpaymenttermonetime} {elseif $product.paytype eq "recurring"} {if $product.pricing.monthly}{$product.pricing.monthly}<br /> {/if} {if $product.pricing.quarterly}{$product.pricing.quarterly}<br /> {/if} {if $product.pricing.semiannually}{$product.pricing.semiannually}<br /> {/if} {if $product.pricing.annually}{$product.pricing.annually}<br /> {/if} {if $product.pricing.biennially}{$product.pricing.biennially}<br /> {/if} {/if} </td> <td width="10%"><input type="button" value="Buy Now"{if $product.qty eq "0"} disabled{/if} onclick="window.location='{$smarty.server.PHP_SELF}?a=add&pid={$product.pid}'" /></td> </tr> {/foreach} </table> <br /> <p align="center"><input type="button" value="{$LANG.viewcart}" onclick="window.location='cart.php?a=view'" /></p> <br /> <table width="95%" border="0" cellpadding="10" cellspacing="0"> <tr> <td> {include file='/home/kitchen2/public_html/templates/orderforms/cart/footer/productgroupname.tpl'} </td> </tr> </table> <br /> <br /> and here is what I have in both cart/header/productgroupname.tpl and cart/footer/productgroupname.tpl hello this workes 0 Quote Link to comment Share on other sites More sharing options...
C Powell Posted July 10, 2009 Share Posted July 10, 2009 how about {php}include('/home/kitchen2/public_html/templates/orderforms/cart/footer/$productgroup.name.tpl);{/php} 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 10, 2009 Author Share Posted July 10, 2009 that gives me a blank page 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 10, 2009 Author Share Posted July 10, 2009 ok if I can not get this way towork could one of you do some code for me with a if group names = xxxxxxx then this elsif = yyyyyy then thisz so I can have the code within the same script ie proudcts.tpl. 0 Quote Link to comment Share on other sites More sharing options...
C Powell Posted July 10, 2009 Share Posted July 10, 2009 ok. never needed to include a tpl. just html and php only. suppose you try google until you get answer from folk here ; ) try keywords like Including an TPL file http://www.google.com/search?hl=en&q=Including+an+TPL+file&aq=f&oq=&aqi= 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 10, 2009 Author Share Posted July 10, 2009 html will be good all I need to pull in is a productgroup Description which is diffrent for each one and i have about 10 to 15 groups I need this for and that may change ether way. but I still need to change the file name on the fly with the P/Group name or id would you have the code for that? Thanks 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 10, 2009 Share Posted July 10, 2009 Where does the custom page (the code above) reside relative to whmcs? 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 10, 2009 Author Share Posted July 10, 2009 whmcs is in my the root of my domainname then all files being used are in templates/orderforms/cart/ as a base. then the page I need to include the custome code (productgroup Description) in is the products.tpl and the custom "hello this workes " is in a folder named header or footer I made within the cart folder and each file in this folder will ether have the name or id of each productgroup i have within my whmcs. but my problem is how within smarty can I dynamicly build a file name using smarty tag's? ie If I have a product group in my whmcs called blog hosting then I would also have a file named blog hosting.tpl or .html or .php with the Description for that group. so when a client look at the proudct group of blod hosting the script will pull the description for that group. so if {$productgroup.name} = blog hosting the file name need to be made is $productgroup.name.tpl = blog hosting.tpl if i just use blog hosting.tpl it works but I need this made with using tag's 0 Quote Link to comment Share on other sites More sharing options...
BAJI26 Posted July 11, 2009 Share Posted July 11, 2009 Ok so the path is correct, then you just have to get the $productgroup.name to work! Maybe Matt can assist. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted July 11, 2009 Share Posted July 11, 2009 (edited) Sorry guys, my mind must have been elsewhere. Put this at the very top of your products.tpl {foreach key=num item=productgroup from=$productgroups} {if $gid eq $productgroup.gid}{assign var=productgroupname value=$productgroup.name|replace:" ":""}{/if} {/foreach} Then use this anywhere within the rest of the products.tpl (no spaces in the name of your file to be included) {include file="orderforms/cart/footer/$productgroupname.tpl"} Edited July 11, 2009 by sparky 0 Quote Link to comment Share on other sites More sharing options...
thehost5968 Posted July 11, 2009 Author Share Posted July 11, 2009 Sorry guys, my mind must have been elsewhere.Put this at the very top of your products.tpl {foreach key=num item=productgroup from=$productgroups} {if $gid eq $productgroup.gid}{assign var=productgroupname value=$productgroup.name|replace:" ":""}{/if} {/foreach} Then use this anywhere within the rest of the products.tpl (no spaces in the name of your file to be included) {include file="orderforms/cart/footer/$productgroupname.tpl"} Thank you for that it works. You are just the best. Thanks 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.