
bfwlite2.0+vue+mysql内容管理系统cms企业建站模板php模板,包含了数据模型搭建、栏目管理、模板管理、自定义页面、内容发布管理、全站静态页面生成(首页、栏目分页、详情页)。
模板示例
网站首页,fetch_category_data可获取栏目id的数据列表并赋值给特定变量进行循环输出
<!DOCTYPE html><html><head> <meta charset="UTF-8"><title>{{ site.site_title }}</title></head><body> <h1>这是一个自定义页面</h1> <p>这里可以写固定的HTML内容。</p> <hr> <h3>新闻</h3> {% fetch_category_data id="1" limit="3" assign_to="company_news" %} <ul> {% for item in company_news.data %} <li>{{ item.title }}</li> {% endfor %} </ul> <h3>笔记</h3> {% fetch_category_data id="2" limit="3" assign_to="company_news2" %} <ul> {% for item in company_news2.data %} <li>{{ item.title }}</li> {% endfor %} </ul></body></html>栏目列表页
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>{{ category.name }} - {{ site.site_title }}</title> <style> /* 为分页链接添加一些基本样式 */ .pagination { margin-top: 20px; } .pagination a, .pagination span { display: inline-block; padding: 8px 12px; margin: 0 2px; border: 1px solid #ddd; text-decoration: none; color: #337ab7; } .pagination span.disabled { color: #ccc; } .pagination span.active { background-color: #337ab7; color: white; border-color: #337ab7; } </style></head><body> <h1>栏目: {{ category.name }}</h1> <div class="post-list"> <!-- 使用 'posts' 作为循环变量,--> {% for post in posts %} <div class="post-item"> <!-- 假设您的内容模型有 'title', 'slug', 'summary' 字段 --> <h2><a href="{{ post.id }}.html">{{ post.title }}</a></h2> <p>{{ post.summary }}</p> <small>发布于: {{ post.created_at }}</small> </div> {% endfor %} </div> <div class="navigation"> {{ pagination_html }} </div></body></html>
内容页
<!DOCTYPE html><html><head> <meta charset="UTF-8"> <title>{{ content.title }}- {{ site.site_title }}</title> <</head><body> <h1>标题: {{ content.title }}</h1> <div> {{ content.cont }}</div></body></html>
网友评论0