wpgcms---详情页面数据怎么渲染
Posted e0yu
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了wpgcms---详情页面数据怎么渲染相关的知识,希望对你有一定的参考价值。
wpgcms的详情页面的数据会被保存在 contentInfo 这么一个字段里面。
面包屑导航调用:
<p>当前位置 {% for c in crumb|slice(1, crumb|length-1) %} {% if not loop.last %}> <a href="{{ c.url }}">{{ c.name }}</a> {% else %}> <span><a href="javascript:;">新闻详情</a></span> {% endif %} {% endfor %} </p>
标题,正文,时间的调用:
<h1>{{ contentInfo.title }}</h1> <div> {% autoescape false %} {{ contentInfo.getBodyInfo() }} {% endautoescape %} </div> <div class="details-news-content-title-time"> <span> {% set pubtime = contentInfo.publish_time %} <span>时间:{{ pubtime|slice(0, 4) }}年{{ pubtime|slice(5, 2) }}月{{ pubtime|slice(8, 2) }}日</span> <span>来源:{{ contentInfo.source_name|default(‘金塔集团‘) }}</span> <span>阅读:{{ contentInfo.view_count }}</span> </span> </div>
下一篇,下一篇的调用:
<p class="next-article-p"> {% set nextInfo = contentInfo.nextInfo %} {% if nextInfo %} <a href="{{ nextInfo.aurl }}"/>下一篇:{{ nextInfo.title }}</a> {% endif %} </p>
完整实例:
{% extends ‘layout.html‘ %} {% block pageContent %} <section> <div class="details-news"> <div class="details-news-content"> <p>当前位置 {% for c in crumb|slice(1, crumb|length-1) %} {% if not loop.last %}> <a href="{{ c.url }}">{{ c.name }}</a> {% else %}> <span><a href="javascript:;">新闻详情</a></span> {% endif %} {% endfor %} </p> <div class="details-news-content-title"> <h1>{{ contentInfo.title }}</h1> <div> {% autoescape false %} {{ contentInfo.getBodyInfo() }} {% endautoescape %} </div> <div class="details-news-content-title-time"> <span> {% set pubtime = contentInfo.publish_time %} <span>时间:{{ pubtime|slice(0, 4) }}年{{ pubtime|slice(5, 2) }}月{{ pubtime|slice(8, 2) }}日</span> <span>来源:{{ contentInfo.source_name|default(‘金塔集团‘) }}</span> <span>阅读:{{ contentInfo.view_count }}</span> </span> </div> <div class="clear"></div> <p class="next-article-p"> {% set nextInfo = contentInfo.nextInfo %} {% if nextInfo %} <a href="{{ nextInfo.aurl }}"/>下一篇:{{ nextInfo.title }}</a> {% endif %} </p> </div> </div> </div> </section> {% endblock %}
以上是关于wpgcms---详情页面数据怎么渲染的主要内容,如果未能解决你的问题,请参考以下文章
Spring boot:thymeleaf 没有正确渲染片段
我的Android进阶之旅NDK开发之在C++代码中使用Android Log打印日志,打印出C++的函数耗时以及代码片段耗时详情