zoukankan      html  css  js  c++  java
  • Smarty中内置标签

    函数类型的标签(smarty中内置标签):

        Array("语文","数学","英语","历史")  遍历成四个单选按钮 组成的按钮组

        <input type="radio" name="" value="" checked="">按钮名称

      单选按钮:

        {ts:html_radios name="" values="" options="" output="" separator=""  checked=""}

        Name:单选按钮组名字

        Values:单选按钮的value值组成的一维索引数组

        Output:单选按钮的文本信息组成的一维索引数组

        Options: 以value作为键名或者索引,以output作为数组元素组成的一维关联数组

        Checked:被选中的单选按钮的value值

        Separator: 设置单选按钮和单选按钮中间的格式标签

     

      复选按钮组:

        {ts:html_checkboxes name="" values="" options="" output="" separator=""  checked=""}

        Checked: 被选中的复选按钮组组成的一维索引数组

        其他值与单选按钮相同

     

      下拉列表框:

        {ts:html_options name="" values="" options="" output="" selected=""}

      【radios.php】

    <?php
    require_once("./smarty.inc.php");
    $values = array('1001','1002','1003','1004');
    $outputs = array('Chinese','Math','English','History');
    $options = array('1001'=>'Chinese','1002'=>'Math','1003'=>'English','1004'=>'History');
    $checked = 1003;
    $checkeds = array('1001','1004');
    
    $tpl -> assign("values",$values);
    $tpl -> assign("outputs",$outputs);
    $tpl -> assign("options",$options);
    $tpl -> assign("checked",$checked);
    $tpl -> assign("checkeds",$checkeds);
    
    $tpl -> display("radios.html");
    ?>

      【radios.html】

    {ts:html_radios name="c1" values=$values output=$outputs checked=$checked}
    <hr/>
    {ts:html_radios name="c2" options=$options checked=$checked}
    <hr/>
    {ts:html_radios name="c3" options=$options checked=$checked separator="<br/>"}
    <hr/>
    <hr/>
    {ts:html_checkboxes name="c4" values=$values output=$outputs checked=$checkeds}
    <hr/>
    {ts:html_checkboxes name="c5" options=$options checked=$checkeds}
    <hr/>
    {ts:html_checkboxes name="c6" options=$options checked=$checkeds separator="<br/>"}
    
    <hr/>
    <hr/>
    {ts:html_options name="c7" values=$values output=$outputs selected=$checked}
    <hr/>
    {ts:html_options name="c8" options=$options selected=$checked}
    <hr/>
    {ts:html_options name="c9" options=$options selected=$checked}
    

    #在radios.php中获取前台radios.html中的值#

  • 相关阅读:
    快递物流查询接口介绍
    DWR
    html网页自动跳转页面代码
    提升Apache网站访问速度的优化方法
    synchronized实现原理
    window下的hosts
    [转]BX9054: 各浏览器对 document.execCommand 方法的首参数可选值范围存在差异
    浏览器关闭或刷新事件--window.onbeforeunload
    浏览器,tab页显示隐藏的事件监听--页面可见性
    http 304
  • 原文地址:https://www.cnblogs.com/shuo-128/p/6869144.html
Copyright © 2011-2022 走看看