Implementing a Show Article page

Let's have a look at the article/show.ftl page, which implements the Show Article page and makes use of the common template shown in the preceding code:

<#import "../common/standardPage.ftl" as p>

<#if article??>
<@p.page title="${article.title}">
<!-- Post Content Column -->
<div class="col-lg-8">

<!-- Title -->
<h1 class="mt-4">${article.title}</h1>

The previous code will check if it has an article to show, and if it does it will show the article title as the title of the page itself. It will follow this by showing a big header on the page with the article title:

    <!-- Author -->
<p class="lead">
by
<#if article.author??>
<a href="#">${article.author.username}</a>
<#else>
Anonymous
</#if>
</p>

<hr>

The preceding code snippet will show the author of the article if it can find one; if not it will show Anonymous.

The following code will show the date when the article was created:

   <!-- Date/Time -->
<p>${article.createdDate?string('dd.MM.yyyy HH:mm:ss')}</p>
<hr>

Furthermore, it has the following code to convert the Article.createdDate property into a string of the format dd.MM.yyyy HH:mm:ss:

   ${article.createdDate?string('dd.MM.yyyy HH:mm:ss')}
<!-- Post Content -->
${article.body}
<hr>
</div>
</@p.page>
</#if>

Eventually, the actual article is shown in its entirety. This page also makes use of the common template. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.220.1.239