文件:section.tpl

<html>
<head>
<title></title>
</head>
<body> {section name=color loop=$colors} {*这里是非关联数组,只是普通数组,这里的形式为:下标=>值 *} {$smarty.section.color.index} => {$colors[color]}<br> {/section} </body>
</html>

文件:section.php

<?php
require("Smarty.class.php");
$smarty = new Smarty();
$smarty -> template_dir = "./templates"; //模板存放目录
$smarty -> compile_dir = "./templates_c"; //编译目录
$smarty -> cache_dir = "./cache"; //缓存目录
$smarty -> config_dir = "./configs"; //缓存目录 $colors = array('红','黄','蓝');
$smarty -> assign('colors',$colors); $smarty -> display('section.tpl'); ?>

最新文章

  1. Steamroller
  2. php 获取中文长度 截取中文字符串
  3. SAP销售模块塑工常见问题和解决方案(自己收藏)
  4. inux grep 命令 搜索含有&quot;zynq&quot;字符的文件
  5. Python使用QRCode模块生成二维码
  6. javascript字符串截取的substring、substr和slice
  7. praise包--R给你点赞!
  8. Javascript模块化编程(三):require.js的用法【转】
  9. getComputedStyle(and currentStyle)
  10. Failed to execute command: &quot;&quot;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\ResGen.exe&quot; 的一个解决办法
  11. 【HDOJ】4317 Unfair Nim
  12. 如何使用eclipse生成javadoc帮助文档
  13. STM32F4xx时钟理解
  14. MySQL日志文件之错误日志和慢查询日志详解
  15. 面向对象oop
  16. uva11636-Hello World!
  17. shell实战之Linux主机系统监控
  18. MySQL 存储过程的变量
  19. Excel文件数据导入到后台保存倒数据库
  20. angular bootstrap timepicker TypeError: Cannot set property &#39;$render&#39; of undefined

热门文章

  1. 【转】MyBatis学习总结(二)——使用MyBatis对表执行CRUD操作
  2. C#学习笔记10:Try-catch的用法和引用类型、值类型整理
  3. Android通过tcpdump抓包(wifi, 2g, 3g都可以)
  4. Spring切面处理
  5. Jquery inArray的使用
  6. ###STL学习--函数对象
  7. Linux用户级线程和内核级线程区别
  8. 轻松解决fedora21装完NVIDIA显卡驱动后无法进入gnome问题
  9. &lt;UNIX环境高级编程&gt;文件共享及fork函数
  10. 我忽略了的DOCTYPE!