Smarty模板

   一:配置 

           1. 创建一个smarty文件夹  

           2. 将下载的包lib文件夹拷到下面

           3. 在smarty下创建templates文件夹

           4. 在templates文件夹下面分别创建 cache  config  templates templates_c四个文件夹

           5. 在templates文件夹下创建你的tpl模板文件

           6. 在php中引入lib下面的smarty.class.php文件,在php中指定相关的目录就可以使用了。

     代码展示:

    $smarty->template_dir="smarty/templates/templates";
    $smarty->compile_dir="smarty/templates/templates_c";
    $smarty->config_dir="smarty/templates/config_dir";
    $smarty->cache_dir="smarty/templates/cache";

   二:linux下运行

           这其中有几个文件夹需要读写权限所以使用chmod命令将四个文件夹得权限改为777就可以了。

 

            chmod 777 file 或者 chmod -R 777 fold

 

 三: 如何指定X轴的内容

 

        代码展示

$Dataset->addPoint(数组,"serial4");
$DataSet->SetAbsciseLabelSerie("Serie4");

 

         这样就会创建一个一数组为x轴内容的图表,但是要注意数组内容不能是数字,否则还是会以数据的格式显示。

 

四: 如何显示百分数

 

          首先使用string_format对数字进行格式化,在利用cat方法进行字符串拼接。

           示例代码:

($percentage|string_format:"%2f")//保留两位小数显示
(($percentage*100|string_format:"%2f")|cat:'%')//乘以100后连接一个"%"
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值