This page in: English - Deutsch - Español - Français - Italiano - Lietuvių - Nederlands - Norsk - Polski - Русский - Svenska - Tiếng Việt - عربي - 日本語 简体中文
Templates
Template Variables
- itemcount - The number of news articles to be shown.
- entry->id - unique record ID
- entry->title - Post title (plain text)
- entry->titlelink - Post title as HTML linked to full news item post.
- entry->link - URL of full news item
- entry->content - Full post content.
- entry->summary - Post summary/teaser text.
- entry->author - user ID of the author of the post.
- entry->authorname - author of the post.
- entry->category - Category that the post belongs to.
- entry->extra
- entry->file_location
- entry->fields - Additional field definitions.
- entry->morelink - Text 'More' linked to full news item post.
- entry->moreurl - URL of full news item
- entry->printlink - Link to printable version.
- entry->printurl - URL to print version of news item
- entry->formatpostdate - Post date of news item formatted according to options settings. Deprecated in News 2.9.
- entry->postdate - Post date of news item.
- entry->startdate - Start date of news item.
- entry->enddate - End date of news item.
- To get a full listing of the values available for each entry, in a detail template, put the smarty code:
{$items|print_r}
Showing Article Title in the Page Title
- Author: calguy1000
- You can change the title area of a detail page, when using the 'detailpage=' parameter of the news (or any other module).
- 1. Modify your news detail templates and add this line:
{assign var='detail_title' value=$entry->title}
- 2. Capture your page content in a variable
- a. Add this code into the
<head>
section of your page template:
{capture assign='captured_content'}{content}{/capture}
- b. Replace the {content} tag lower in your template with {$captured_content}
- 3. Replace the title section of your page template to look something like this:
{if isset($detail_title)} <title>{sitename} - {$detail_title}</title> {else} <title>{sitename} - {title}</title> {/if}
Blog Template
- Author: Elijah Lofgren
- Note: This template used the User Defined Tag called "count_news_comments" which is on Comments
Summary Template
<!-- Start News Display Template --> {foreach from=$items item=entry} <div class="NewsSummary"> <h2 class="NewsSummaryLink">{$entry->titlelink}</h2> {if $entry->formatpostdate} <div class="NewsSummaryPostdate"> {$entry->formatpostdate} </div> {/if} {if $entry->summary} <div class="NewsSummarySummary"> {eval var=$entry->summary} </div> <div class="NewsSummaryMorelink"> [{$entry->morelink}] </div> {else if $entry->content} <div class="NewsSummaryContent"> {eval var=$entry->content} </div> {/if} <div style="border-top:1px solid black; margin-top:1em;"> {if $entry->author} <div class="NewsSummaryAuthor" style="float:left;"> Posted by {$entry->authorname} in {$entry->category} </div> {/if} <div style="text-align:right;"><a href="{$entry->link}">{count_news_comments thenewsid=$entry->id} comments</a></div> </div> </div> {/foreach} <!-- End News Display Template -->
Detail Template
<h2 id="NewsPostDetailTitle">{$entry->title}</h2> {if $entry->formatpostdate} <div id="NewsPostDetailDate"> {$entry->formatpostdate} </div> {/if} {if $entry->summary} <div id="NewsPostDetailSummary"> <strong> {eval var=$entry->summary} </strong> </div> {/if} <div id="NewsPostDetailContent"> {eval var=$entry->content} </div> <div style="border-top:1px solid black; margin-top:1em;"> {if $entry->author} <div class="NewsSummaryAuthor" style="float:left;"> Posted by {$entry->authorname} in {$entry->category} </div> {/if} <div style="text-align:right;"> <a href="{$entry->link}">{count_news_comments thenewsid=$entry->id} comments</a></div> </div> {cms_module module='comments' modulename='News' pageid=$entry->id websitefield=1 emailfield=1} <div id="NewsPostDetailPrintLink"> {$entry->printlink} </div> {if $return_url != ""} <div id="NewsPostDetailReturnLink">{$return_url}</div> {/if}
recent_blog_posts
- Author: Elijah Lofgren
- Create a new summary template called
recent_blog_posts
with the following content:
<ul> {foreach from=$items item=entry} <li><a href="{$entry->link}">{$entry->titlelink}</a> <br /> {if $entry->summary} {eval var=$entry->summary} {/if} <br /> {if $entry->formatpostdate} Posted {$entry->formatpostdate} {/if} in {$entry->category} - <a href="{$entry->link}">{count_news_comments thenewsid=$entry->id} comments</a> </li> {/foreach} </ul>
- Call it with this:
<h2>Latest 5 blog posts</h2> {cms_module module='news' number='5' summarytemplate='recent_blog_posts'}
This page in:
English -
Deutsch -
Español -
Français -
Italiano -
Lietuvių -
Nederlands -
Norsk -
Polski -
Česky -
Русский -
Svenska -
Tiếng Việt -
عربي -
日本語
简体中文