• freemaker的函数使用


    如下:

    <html>
       <body>
          <div class="container">
          <h4>修改用户角色</h4>
    <#function contain userList roleTypeId>
    	<#local num=0>
    	<#list userList as userList>
    		<#if userList.roleTypeId ==roleTypeId>
    			<#local num = num +1 >
    		</#if>
    	</#list>
    	<#return num>
    </#function>
        <form role="form" method="post" action="/userManage/userRoleSave" enctype="multipart/form-data">
            <label class="label-tips" for="u">账号:</label>
            <span id="username">${(userinfo.username)!''}</span><p>
            
            <label class="label-tips" for="nickname">昵称:</label>
            <span id="nickname">${(userinfo.nickname)!''}</span><p>
                    
            <label class="label-tips" for="roles">已有角色:</label><p>
            <#list userinfo.roles as userRoleList>
            <tr>
            	<td>
            		<span id="roleName">${(userRoleList.roleTypeId)!''}.${(userRoleList.roleName)!''}&nbsp&nbsp&nbsp&nbsp</span>
            	</td>
            </tr>
            </#list><p>
    		<label class="label-tips" for="u">修改角色: </label><p>
            <#list roles as rolesList>
            	<input type="checkbox" name="roleTypeIdList" id="sexMAN" value="${(rolesList.roleTypeId)!''}"  <#if contain(userinfo.roles,rolesList.roleTypeId)==1 > checked="checked" </#if>>${(rolesList.roleTypeId)!''}.${(rolesList.roleName)!''}&nbsp&nbsp&nbsp&nbsp  			
      	</#list>
            	<input hidden type="text" name="userid" value="${(userinfo.userid)!''}"><p>
                 <input type="submit" name="修改"/>${(msg?if_exists)!''}
        </form>
        
    </div>
    
    </body>
    </html>
    

      

  • 相关阅读:
    8月6日总结
    8月4日总结
    8月3日总结
    快速幂计算题解
    7月31日总结
    7月30日总结
    关于PHP中”::”能够调用一个非静态的方法的解释
    码云 使用 svn 管理项目
    Mysql的数据类型
    thinkphp5的$this->fetch()
  • 原文地址:https://www.cnblogs.com/amoyzhu/p/9203346.html
Copyright © 2020-2023  润新知