完成我的中心 導航標籤

      1. 我的中心—視圖函數帶標籤頁面參數tag
        @app.route('/usercenter/<user_id>/<tag>')
        def usercenter(user_id, tag):
           if tag == ‘1':
               return render_template('usercenter1.html', **context)

      2. 我的中心—導航標籤連接增長tag參數
        <li role=「presentation」><a href=「{{ url_for(‘usercenter’,user_id = user.id,tag = ‘1’) }}">所有問答</a></li>
      3. 我的中心—有連接到我的中心頁面的url增長tag參數
        u <a href="{{ url_for('usercenter',user_id = session.get('userid'), tag=1) }}">{{ session.get('user') }}</a>
    1. {% extends 'base.html' %}
      {% block title %}
      我的中心
      {% endblock %}

      {% block link %}

      {% endblock %}

      {% block box %}
      <div class="container">
      <div class="row clearfix">
      <div class="col-md-2 column">
      </div>
      <div class="col-md-8 column">
      <ul class="nav nav-tabs">
      <li role="presentation"><a href="{{ url_for('comment',user_id=user2.id,num='1') }}">所有問題</a></li>
      <li role="presentation"><a href="{{ url_for('comment',user_id=user2.id,num='2') }}">所有評論</a></li>
      <li role="presentation"><a href="{{ url_for('comment',user_id=user2.id,num='3') }}">我的信息</a></li>
      </ul>
      {% block subComment %}{% endblock %}
      </div>
      <div class="col-md-2 column">
      </div>
      </div>
      </div>
      {% endblock %}

      {% block script %}

      {% endblock %}
    2. {% extends 'comment.html' %}
      {% block subComment %}
      <ul class="list-group" style="">
      <h1>所有問題</h1>
      {% for foo in questions %}
      <li class="list-group-item" style="width: 800px">
      <a class="wrap-img" href="#" target="_blank">
      <img src="http://www.bookmarkye.com/3.jpg" width="50px">
      </a>
      <span class="glyphicon glyphicon-left" aria-hidden="true"></span>
      <a href="{{ url_for('comment',user_id=foo.author.id ,num='1')}}"
      target="_blank">{{ foo.author.username }}</a>
      <br>
      <a href="{{ url_for('detail',question_id=foo.id) }}">{{ foo.title }}</a>
      <span class="badge">{{ foo.creat_time }}</span>
      <p style="">{{ foo.detail }}
      </p>
      </li>

      {% endfor %}
      </ul>
      {% endblock %}
      <ul class="list-group" style="margin-top: 30px;">
      <h1>所有評論</h1>
      {% for com in comment %}
      <li class="list-group-item" style="width: 800px">
      <a class="wrap-img" href="#" target="_blank">
      <img src="http://www.bookmarkye.com/3.jpg" width="50px">
      </a>
      <span class="glyphicon glyphicon-left" aria-hidden="true"></span>
      <a href="{{ url_for('comment',user_id=com.author.id,num='1') }}"
      target="_blank">{{ com.author.username }}</a>
      <br>
      <span class="badge">{{ com.creat_time }}</span>
      <p style="">{{ com.detail }}</p>
      </li>
      {% endfor %}
      </ul>
      <div class="list-group-item" style="margin-top: 30px;width: 800px;">    <h1>名稱:        <small>{{ user2.username }}</small>    </h1>    <h1>問題數:        <small>{{ questions|length }}</small>    </h1>    <h1>評論數:        <small>{{ comment|length }}</small>    </h1></div>
相關文章
相關標籤/搜索