Destramic Posted November 14, 2010 Share Posted November 14, 2010 my firefox won't open up .tpl format im running apache...how can i view that format on my apache please? Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/ Share on other sites More sharing options...
BlueSkyIS Posted November 14, 2010 Share Posted November 14, 2010 .tpl as i know it is a template used by a template system like smarty. i don't think you'll have apache parsing .tpl files. Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/#findComment-1133930 Share on other sites More sharing options...
Destramic Posted November 14, 2010 Author Share Posted November 14, 2010 no way to include that format on your website other than smarty? Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/#findComment-1133949 Share on other sites More sharing options...
Destramic Posted November 14, 2010 Author Share Posted November 14, 2010 anyone know how this is possible please? Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/#findComment-1134094 Share on other sites More sharing options...
BlueSkyIS Posted November 14, 2010 Share Posted November 14, 2010 you need something to interpret the template file, either smarty or whatever the template was developed for. not every templating system uses the same... anything. without knowing what the template was created for, it's not possible to tell you exactly what system you'll need to use to display it. Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/#findComment-1134126 Share on other sites More sharing options...
Destramic Posted November 15, 2010 Author Share Posted November 15, 2010 ok i see...is there a site tutorial that i can use to make that system please? Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/#findComment-1134342 Share on other sites More sharing options...
Pikachu2000 Posted November 15, 2010 Share Posted November 15, 2010 If there's php code within the .tpl file, and you include() it in a .php script, it will be parsed by the php interpreter. If you call the .tpl file into the browser on its own, it won't. Is that what you're trying to figure out? Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/#findComment-1134459 Share on other sites More sharing options...
BlueSkyIS Posted November 15, 2010 Share Posted November 15, 2010 in my experience with smarty templates (.tpl), the PHP inside the .tpl file is modified to be 'smarty-friendly'. that is, there is no standard PHP, per se, but smarty-formatted PHP that looks like this: {php}echo "hello world";{/php} However, many times a .tpl file will have no PHP code at all, just smarty-type values, functions and loops which are a different syntax compared to PHP. for instance, here is a bit of code from a template: {if $totalnumofrows gt 0} <h2>Showing <span id="showmatch"> {$LimitFrom+1} - {$LimitFrom+$pagenumofrows} of {$totalnumofrows}</span> matches</h2> {elseif $totalnumofrows eq 1} <h2>Showing 1 match</h2> {else} <h2>No matches found.</h2> {/if} The $ values in the template are defined outside of the template, then substituted into the template at run-time. in the case of smarty, setting the values before loading the template looks like this (PHP): $smarty->assign('somevariable', 12345); Then, inside the template, {$somevariable} will be replaced with 12345. Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/#findComment-1134467 Share on other sites More sharing options...
Destramic Posted November 15, 2010 Author Share Posted November 15, 2010 there is no php in my template just template varables but i need to know how to include the template file into my php file? Quote Link to comment https://forums.phpfreaks.com/topic/218600-template-tpl-unable-to-view/#findComment-1134679 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.