博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
wpgcms---详情页面数据怎么渲染
阅读量:6879 次
发布时间:2019-06-27

本文共 2055 字,大约阅读时间需要 6 分钟。

wpgcms的详情页面的数据会被保存在 contentInfo 这么一个字段里面。

面包屑导航调用:

当前位置 {

% for c in crumb|slice(1, crumb|length-1) %} {
% if not loop.last %}> {
{ c.name }}
{
% else %}> 新闻详情 {
% endif %}{
% endfor %}

标题,正文,时间的调用:

{
{ contentInfo.title }}

{% autoescape false %} {
{ contentInfo.getBodyInfo() }} {% endautoescape %}
{% set pubtime = contentInfo.publish_time %} 时间:{
{ pubtime|slice(0, 4) }}年{
{ pubtime|slice(5, 2) }}月{
{ pubtime|slice(8, 2) }}日
来源:{
{ contentInfo.source_name|default('金塔集团') }}
阅读:{
{ contentInfo.view_count }}

下一篇,下一篇的调用:

{% set nextInfo = contentInfo.nextInfo %} {% if nextInfo %} 下一篇:{

{ nextInfo.title }} {% endif %}

完整实例:

{% extends 'layout.html' %}{% block pageContent %}

当前位置 {% for c in crumb|slice(1, crumb|length-1) %} {% if not loop.last %}> {

{ c.name }} {% else %}> 新闻详情 {% endif %} {% endfor %}

{
{ contentInfo.title }}

{% autoescape false %} {
{ contentInfo.getBodyInfo() }} {% endautoescape %}
{% set pubtime = contentInfo.publish_time %} 时间:{ { pubtime|slice(0, 4) }}年{ { pubtime|slice(5, 2) }}月{ { pubtime|slice(8, 2) }}日 来源:{ { contentInfo.source_name|default('金塔集团') }} 阅读:{ { contentInfo.view_count }}

{% set nextInfo = contentInfo.nextInfo %} {% if nextInfo %} 下一篇:{

{ nextInfo.title }} {% endif %}

{% endblock %}

 

转载于:https://www.cnblogs.com/e0yu/p/9928409.html

你可能感兴趣的文章