什么是.tpl文件?PHP,网页设计 [英] What are .tpl files? PHP, web design
问题描述
有人希望我重新设计一个在PHP(VideoCMS)中运行的网站.但是,当我要求他向我发送源代码时,他给了我* .tpl文件而不是* .php文件.其中包含一些代码:
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}
或
{include file='header.tpl' p="index"}
{php} $_SESSION['isFair'] = "Yes"; {/php}
代码的解释器是什么?如何重新设计此网站?
What's the interpreter of the code? How can I redesign this site?
推荐答案
在我看来这很聪明.Smarty是用PHP编写的模板解析器.
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.
如果您无法访问CMS的源代码:要在浏览器中查看模板,只需查看Smarty正在使用的变量,然后创建一个PHP文件,该文件将用dummy填充已使用的变量数据.
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.
如果我没记错的话,一旦设置好Smarty,就可以使用:
If I remember correctly, once Smarty is set up, you can use:
$smarty->assign('nameofvar', 'some data');
设置变量.
这篇关于什么是.tpl文件?PHP,网页设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!