i has the following pattern structure in the bulb:
templates/
/posts
list.html
base.html
index.html
my base.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>ITV</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="{{ url_for('static', filename='css/main.css') }}">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
</head>
<body>
{%- block topbar -%}
<nav class="navbar navbar-default navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/"></a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-8">
<ul class="nav navbar-nav">
<li class="active"><a href="/"></a></li>
<li><a href="/posts"></a></li>
<li><a href="/schedue"> </a></li>
</ul>
</div>
</div>
</nav>
{%- endblock -%}
<div class="container">
<div class="content">
{% block page_header %}{% endblock %}
{% block content %}{% endblock %}
</div>
</div>
</body>
</html>
I can display a template, for example: render_template ('posts / list.html'), which extends my base.html
my list.html:
{% extends "base.html" %}
{% block content %}
Posts
{% endblock %}
How can I set the menu of active elements in base.html
<li class="active"><a href="/"></a></li>
<li><a href="/posts"></a></li>
<li><a href="/schedue"> </a></li>
when am I processing list.html and cannot pass the data directly to base.html?
source
share