zoukankan      html  css  js  c++  java
  • freemarker基本知识总结

    1、取出内容

    ${} 例如,${document.fileName}

    2、

     <ul>
    <#list cms.documents("channel=XXXX") as document>
    <#switch document_index%3>
    <#case 0>
    <li style="357px;"><a href="#" title="${document.title}">${cms.substring(document.title, 20, "...")}</a></li>
     <#break>
    <#case 1>
    <li style="332px;"><a href="#" title="${document.title}">${cms.substring(document.title, 18, "...")}</a></li>
     <#break>
    <#case 2>
    <li style="281px;"><a href="#" title="${document.title}">${cms.substring(document.title, 15, "...")}</a></li>
     <#break>
    
    
    </#switch>
    </#list>
                      </ul>

    以上代码包括<#list></#list>(这是循环遍历)<#switch></#switch>其中

     document_index是下标

    3、
    </#if>标签与else标签结合一起使用,控制逻辑
    A、
    <#if x = 1>
      x is 1
    </#if> 
    B、
    <#if x = 1>
      x is 1
      <#else>
     x is not 1
    </#if>
    C、
    <#if x = 1>
      x is 1
    <#elseif x = 2>
      x is 2
    <#elseif x = 3>
      x is 3
    </#if>  
    D、
    <#if x = 1>
      x is 1
    <#elseif x = 2>
      x is 2
    <#elseif x = 3>
      x is 3
    <#elseif x = 4>
      x is 4
    <#else>
      x is not 1 nor 2 nor 3 nor 4
    </#if> 

    以上是if else 控制语句。

    
    
  • 相关阅读:
    PHP入门
    requests中text,content,json之间的区别
    有关pip报错的问题

    pycharm操作
    python selenium 相关操作
    python tkinter菜单
    初识Go
    Python _easygui详细版
    easygui _1
  • 原文地址:https://www.cnblogs.com/woxiangxintj/p/4500780.html
Copyright © 2011-2022 走看看