zoukankan      html  css  js  c++  java
  • python jinja2模板分页效果

    html

        <div class="vendor-paging"><!--paging -->
          <div class='vendor-page-numbers'><!-- page button -->
            {% if vendor_page != 1 %}<a class='vendor-page-left-right page-pre' href='javascript:void(0);'><img class='left-right-image' src='/static/images/scroll_left.png'/></a>{% endif %}
            {% for i in range(1, page_total + 1) %}
              <a class='page-digital {% if vendor_page == i %}page-selected{% endif %}' href='javascript:void(0);' num="{{ i }}"><span class='page-number'>{{i}}</span></a>
            {% endfor %}
            {% if vendor_page != page_total and page_total%}<a class='vendor-page-left-right page-next' href='javascript:void(0);'><img class='left-right-image' src='/static/images/scroll_right.png'/></a>{% endif %}
          </div><!-- page button -->
          <div class="show-page-info font-s-14">
            <div class="gl-inline" style="line-height: 30px;">共{{ total }}家 ({% if total %}{{ start}}{% else %}0{% endif %}-{% if vendor_page < page_total%}{{ vendor_page * count }}{% else %}{{ total }}{% endif %}) 显示</div>
            <div class="select-style gl-inline" style=" 135px;">
            <select id="page-number" class="select">
              <option value="1" {% if count == 1 %}selected{% endif %}>1每页</option>
              <option value="20" {% if count == 20 %}selected{% endif %}>20每页</option>
              <option value="30" {% if count == 30 %}selected{% endif %}>30每页</option>
              <option value="50" {% if count == 50 %}selected{% endif %}>50每页</option>
              <option value="100" {% if count == 100 %}selected{% endif %}>100每页</option>
              <option value="250" {% if count == 250 %}selected{% endif %}>250每页</option>
            </select>
            </div>
          </div>
        </div><!--paging -->
    

    <input name="current_page" id="current_page" value={{ current_page }} type="hidden"></input>
    <input name="count" id="count" value={{ count }} type="hidden"></input>

    python

    #pagination
    current_page = int(params['current_page'])
    count = int(params['count'])
    start = (current_page - 1) * count
    params['start'] = start
    second_level_url = params['second_level_url']
    params['op'] = "getVendorProducts"
    params['count'] = count
    vendor_cars, car_total = rpc('vendor', params)
    page_total = int(ceil(float(car_total) / count))

  • 相关阅读:
    [国嵌攻略][047][MMU功能解析]
    [国嵌攻略][045-046][一跃进入C大门]
    [国嵌攻略][044][初始化Bss段]
    [国嵌攻略][043][栈初始化]
    [国嵌攻略][042][代码搬移不可少]
    [国嵌攻略][041][6410和210内存初始化]
    [国嵌攻略][040][2440内存初始化]
    页面中加入回到顶部按钮的实现方法(转)
    【总结整理】js获取css的属性(内部,外部,内嵌(写在tag中))
    【总结整理】前端‘变量名’‘类名’‘函数名’的命名规则
  • 原文地址:https://www.cnblogs.com/xuedong09/p/3173725.html
Copyright © 2011-2022 走看看