diff --git a/blueprint/blog_views.py b/blueprint/blog_views.py index 3b941fd..f3c1dc1 100755 --- a/blueprint/blog_views.py +++ b/blueprint/blog_views.py @@ -44,11 +44,13 @@ def posts_list(): def show_posts_id(posts_id): conn = get_owp_db_conn() sql_posts = "SELECT * FROM posts WHERE status = 1 AND id = ?" + sql_message = "SELECT * FROM messages WHERE posts_id = ?" posts = conn.execute(sql_posts, (posts_id,)).fetchone() + message = conn.execute(sql_message, (posts_id,)).fetchall() conn.close() if posts is None: return f'未找到该文章{posts_id}未找到该文章{posts_id}', 404 - return render_template('blog/posts.html', posts=posts) + return render_template('blog/posts.html', posts=posts, message=message[::-1]) diff --git a/packages/__init__.py b/packages/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/templates/blog/base.html b/templates/blog/base.html new file mode 100644 index 0000000..ef693d4 --- /dev/null +++ b/templates/blog/base.html @@ -0,0 +1,55 @@ +{# base_home模板 #} + + + {% block title %}{% endblock %} | ww3 + +
+ {% block logs_and_page %} + {# 这里存放写入模板的数据 #} + {% endblock %} +
+ + {% include 'blog/footer.html' %} + + + +{# css部分 #} + \ No newline at end of file diff --git a/templates/blog/footer.html b/templates/blog/footer.html new file mode 100644 index 0000000..e3db7ee --- /dev/null +++ b/templates/blog/footer.html @@ -0,0 +1,27 @@ + \ No newline at end of file diff --git a/templates/blog/head.html b/templates/blog/head.html new file mode 100644 index 0000000..2b75b4e --- /dev/null +++ b/templates/blog/head.html @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/templates/blog/home.html b/templates/blog/home.html index 6dc3d50..e7f5f66 100644 --- a/templates/blog/home.html +++ b/templates/blog/home.html @@ -1,9 +1,13 @@ {# 引入base #} -{% extends 'blog/home_base.html' %} +{% extends 'blog/base.html' %} {# 引入标题 #} {% block title %}首页{% endblock %} +{% include 'blog/head.html' %} + +{% include 'blog/wallpaper.html' %} + {% block logs_and_page %}

欢迎访问open-ww3-project

@@ -52,13 +56,13 @@ \ No newline at end of file diff --git a/templates/blog/navbar.html b/templates/blog/navbar.html new file mode 100644 index 0000000..6a5990a --- /dev/null +++ b/templates/blog/navbar.html @@ -0,0 +1,19 @@ +{# navbar 部分 #} + +{% set navbar_list = [ + {"id":1, "name": "首页", "url": url_for('blog.home')}, + {"id":2, "name": "关于", "url": url_for('blog.about')}, + {"id":3, "name": "文章", "url": url_for('blog.posts_list')}, + {"id":4, "name": "mirrors", "url": url_for('blog.autoindex')}, + {"id":5, "name": "study", "url": url_for('study.home')}, +]%} + +
\ No newline at end of file diff --git a/templates/blog/posts.html b/templates/blog/posts.html index 77052cb..cb52eef 100755 --- a/templates/blog/posts.html +++ b/templates/blog/posts.html @@ -10,6 +10,17 @@

{{ posts['content'].replace('&a&a','') | safe}} +
+
+
+

留言区:

+ {% for message in message %} + [ {{ message['name'] }} ] >$ + {{ message['content'] }}
+ {{ message['date'] }} +
+
+ {% endfor %} \ No newline at end of file