zoukankan      html  css  js  c++  java
  • 完成个人中心—导航标签

      1. 个人中心—视图函数带标签页面参数tag
        @app.route('/usercenter/<user_id>/<tag>')
        def usercenter(user_id, tag):
           if tag == ‘1':
               return render_template('usercenter1.html', **context)
         if tag=='1':
                return render_template('user1.html',**context)
            elif tag=='2':
                return render_template('user2.html',**context)
            else:
                return render_template('user3.html',**context)
        

          

      2. 个人中心—导航标签链接增加tag参数
        <li role=“presentation”><a href=“{{ url_for(‘usercenter’,user_id = user.id,tag = ‘1’) }}">全部问答</a></li>
        <ul class="nav_ul">
                <li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id,tag=1) }}">questions</a></li>
                <li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id,tag=2) }}">comments</a></li>
                <li role="presentation"><a href="{{ url_for('usercenter',user_id=user.id,tag=3) }}">information</a></li>
            </ul>
        

          

      3. 个人中心—有链接到个人中心页面的url增加tag参数
        u <a href="{{ url_for('usercenter',user_id = session.get('userid'), tag=1) }}">{{ session.get('user') }}</a>
        <a href="{{ url_for('usercenter',user_id = foo.author_id,tag=1) }}">{{ foo.author.username }}
        

          

  • 相关阅读:
    vim 命令替换重复命令
    Python环境安装
    MySQL 查看show profile
    XSS攻击与CSRF攻击与防御
    HTTPS的原理
    PHP curl的请求步骤
    【论文阅读】HRNet
    【学习笔记】gRPC-python
    【Linux学习笔记】Linux基础
    【Golang学习笔记】入门:结构体、方法与接口
  • 原文地址:https://www.cnblogs.com/Sun584125503/p/8043231.html
Copyright © 2011-2022 走看看