zoukankan      html  css  js  c++  java
  • 夺命雷公狗---Smarty NO:20 html_radios函数

    功能:把数组转化单选按钮

    基本语法:

    {html_radios values=$cust_ids checked=$customer_id output=$cust_names separator=”<br />”}

    参数说明:

    参数功能与checkbox复选框一致,但是checked要求是一个固定的值

    demo6.html代码示例:

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset=’utf-8′>
    <title></title>
    </head>
    <body>
    {*html_radios*}
    {html_radios name=’like’ output=$output values=$values checked=1 separator=”<br/>”}
    </body>
    </html>

    demo6.php代码示例:

    <?php
    require “smarty/Smarty.class.php”;
    $smarty = new Smarty();
    //output假如是从数据库中读取出来的数据
    $output = array(‘php’,’apache’,’mysql’,’linux’);
    $values = array(1,2,3,4);//依次对应上面的值得
    $smarty -> assign(‘output’,$output);
    $smarty -> assign(‘values’,$values);
    $smarty -> display(‘demo6.html’);
  • 相关阅读:
    寒假学习第一天
    课堂测试
    第十六周总结
    第十五周总结
    计算最长单词链
    第十四周总结
    人月神话阅读笔记03
    人月神话阅读笔记02
    第十五周学习进度
    冲刺第二十天
  • 原文地址:https://www.cnblogs.com/leigood/p/5033433.html
Copyright © 2011-2022 走看看