php + smarty

作者: brzhang | 来源:发表于2016-03-02 18:14 被阅读91次

往模板中写入数据

$this->tpl->assign(array(   
     'game_rewards' => $game_rewards,
  )
);

没有数据可以不写入数据,下面渲染出一个模板:

$this->tpl->display('../template/game_app/game_reward.tpl');

在模板中渲染出数据

<{php}>    
    foreach($game_rewards as $game_reward){        
        echo $game_reward."\n";    
    }
<{/php}>

php代码块需要使用<{php}>和<{/php}>包含起来。

相关文章

  • php + smarty

    往模板中写入数据 没有数据可以不写入数据,下面渲染出一个模板: 在模板中渲染出数据 php代码块需要使用<{php...

  • Smarty模板

    PHP模板引擎 该文档使用的是Smarty 3.1.33 Released版本 什么是PHP模板引擎? php模板...

  • Smarty--(2)创建配置文件

    完成Smarty配置工作是应用Smarty模板引擎的关键。config.php 下面,我们来一一解读1.defin...

  • PHP+smarty对checkbox的初始化和绑定

    在PHP+smarty中对checkbox进行加载时候,和其他的不一样.smarty有自带的checkbox自定义...

  • Ecstore vobject插件使用

    smarty解析时调用business/lib/view/input.php =〉 function input_...

  • 2018-06-15 h5开发记录

    php加载流程php - > html -> js+cssphp1.smarty赋值 2.发起请求 3.变量普通变...

  • 2018-05-11Smarty模板引擎

    Smarty(模板引擎) 一、什么是模板引擎? Smarty是一个php模板引擎。更准确的说,它分开了逻辑程序和外...

  • Smarty - 学习

    学习 注意,使用Smarty,一般来说,可以直接将Smarty.class.php拷贝到项目中就行,可以是项目li...

  • smarty 的安装与试用

    关注的缓存自然后端页面缓存相关,从php的smarty的缓存切入,所以就安装用下。 下载 目前smarty有3.x...

  • PHP-Smarty

    test.htmltest.html.phptest.php

网友评论

本文标题:php + smarty

本文链接:https://www.haomeiwen.com/subject/zvpnkttx.html