Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are .tpl files? PHP, web design

Tags:

html

php

smarty

Someone wants me to redesign a site run in PHP (VideoCMS). But when I asked him to send me the source he has given me *.tpl files instead of *.php. There is some code inside them:

{include file='header.tpl' p="article"}  <br /> <table width="886" border="0" cellspacing="0" cellpadding="0">   <tr>     <td width="150" valign="top">     <div id="reg_box">     <h3 class="captions">{$lang.articles}</h3>         <div id="list_cats">         <ul>             {$article_categories}         </ul>         </div>     </div>     <br />     <div id="reg_box">     <h3 class="captions">{$lang.members}</h3>     {if $logged_in == '1'}     {include file='loggedin_body.tpl'}     {else}     {include file='login_body.tpl'}     {/if} 

or

{include file='header.tpl' p="index"}  {php} $_SESSION['isFair'] = "Yes"; {/php} 

What's the interpreter of the code? How can I redesign this site?

like image 832
Dan Avatar asked Nov 27 '09 11:11

Dan


People also ask

How do I create a TPL file?

Go to menu Options → Tools. Under Miscellaneous, select the Files tab. Click new file extension, enter tpl. In Associated File Type (MIME), select HTML Files (text/html)

What is TPL HTML?

The . tpl file extension is used by a template parser called Smarty. This is an HTML template parser. Developers append . html to the end of the file so they can be recognized by text editors as HTML file and provide syntax checking, intellisense, and stuff.

How do you use templates in PHP explain?

A PHP template engine is a way of outputting PHP in your HTML without using PHP syntax or PHP tags. It's supposed to be used by having a PHP class that will send your HTML the variables you want to display, and the HTML simply displays this data.


2 Answers

That looks like Smarty to me. Smarty is a template parser written in PHP.

You can read up on how to use Smarty in the documentation.

If you can't get access to the CMS's source: To view the templates in your browser, just look at what variables Smarty is using and create a PHP file that populates the used variables with dummy data.

If I remember correctly, once Smarty is set up, you can use:

$smarty->assign('nameofvar', 'some data'); 

to set the variables.

like image 97
Chris Clarke Avatar answered Oct 14 '22 05:10

Chris Clarke


Templates. I think that is Smarty syntax.

like image 40
Quentin Avatar answered Oct 14 '22 03:10

Quentin