dqellle310167 2009-11-27 11:48
浏览 60
已采纳

什么是.tpl文件? PHP,网页设计

A man 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}

Question: what's the interpreter of the code? How to redesign this site?

  • 写回答

10条回答 默认 最新

  • duandou8457 2009-11-27 11:54
    关注

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(9条)

报告相同问题?

悬赏问题

  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路