When I click on one of the options in the SideBar, I want the content related to it to open on the right side.
I wrote the code below, but even though I reach the “http://127.0.0.1:5000/admin_panel_menu/A” page, SideBar appears, but the text in contentA.html does not appear. How can I fix this?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="/static/css/admin_panel.css">
<title>Admin Paneli</title>
</head>
<body>
<div class="sidebar">
<!-- Sidebar içeriği -->
<div class="menu">
<ul>
<li class="active">
<a href="{{ url_for('admin_panel_menu', panel_id='A') }}"> A</a>
</li>
<li>
<a href="{{ url_for('admin_panel', panel_id='B') }}"> B</a>
</li>
<li>
<a href="{{ url_for('admin_panel', panel_id='C') }}"> C</a>
</li>
</ul>
</div>
</div>
<div class="content">
<!-- İçerik gösterilecek alan -->
{% block content %}
{% endblock %}
</div>
</body>
</html>
@app.route("/admin_panel")
def admin_panel():
return render_template("admin_panel.html")
@app.route('/admin_panel_menu/<panel_id>')
def admin_panel_menu(panel_id):
# content_id'ye göre ilgili içeriği gönder
if panel_id == 'A':
return render_template('contentA.html')
else:
# Hata durumunda başka bir sayfaya yönlendirme yapılabilir
return redirect('/gadmin')
I would be happy if you help
New contributor
Richpoort123 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.