Articles Gabarit A TRADUIRE

Notes Importantes : la Version 2.9 de news (Articles) a supprimé le format "formatpostdate" des gabarits, et a également supprimé le paramètre "dateformat". Vous devez utiliser le paramètre "cms_date_format" (comme indiqué dans les gabarits par défaut) pour le format des dates, et devrez utiliser entry->postdate au lieu de entry->formatpostdate dans vos gabarits.

Variables du gabarit

  • 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->postdate - Post date of news item formatted according to options settings.(ancien entry->formatpostdate)
  • entry->postdate - Post date of news item.
  • entry->startdate - Start date of news item.
  • entry->enddate - End date of news item.


Pour obtenir une liste complète des valeurs disponibles pour chaque entrée, dans un gabarit de détail, mettre le code suivant :
  {$items|print_r}

Afficher le titre de l'article dans le titre de la page

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}

Gabarit de Blog

Author: Elijah Lofgren
Note: This template used the User Defined Tag called "count_news_comments" which is on Comments

Gabarit du sommaire article

<!-- Start News Display Template -->
{if $pagecount > 1}
  <p>
{if $pagenumber > 1}
<a href='{$firsturl}'><img src='uploads/images/icon/arrow-first.gif' alt=''/></a>
<a href='{$prevurl}'><img src='uploads/images/icon/arrow-prev.gif' alt=''/></a>
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
 
<a href='{$nexturl}'><img src='uploads/images/icon/arrow-next.gif' alt=''/></a>
<a href='{$lasturl}'><img src='uploads/images/icon/arrow-last.gif' alt=''/></a>
{/if}
</p>
{/if}

{foreach from=$items item=entry}
<div class="NewsSummary">

{if $entry->postdate}
	<div class="NewsSummaryPostdate">
		{$entry->postdate|cms_date_format}
	</div>
{/if}

<div class="NewsSummaryLink">
	{$entry->titlelink}
</div>

<div class="NewsSummaryCategory">
	{$category_label} {$entry->category}
</div>

{if $entry->author}
	<div class="NewsSummaryAuthor">
		{$author_label} {$entry->author}
	</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}

{if isset($entry->extra)}
    <div class="NewsSummaryExtra">
        {eval var=$entry->extra}
	{* {cms_module module='Uploads' mode='simpleurl' upload_id=$entry->extravalue} *}
    </div>
{/if}
{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     <div class="NewsSummaryField">
        {if $field->type == 'file'}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {$field->name}: {eval var=$field->value}
        {/if}
     </div>
  {/foreach}
{/if}

</div>
{/foreach}
<!-- End News Display Template -->

Gabarit du détail article

{if $entry->postdate}
	<div id="NewsPostDetailDate">
		{$entry->postdate|cms_date_format}
	</div>
{/if}
<h3 id="NewsPostDetailTitle">{$entry->title}</h3>

<hr id="NewsPostDetailHorizRule" />

{if $entry->summary}
	<div id="NewsPostDetailSummary">
		<strong>
			{eval var=$entry->summary}
		</strong>
	</div>
{/if}

{if $entry->category}
	<div id="NewsPostDetailCategory">
		{$category_label} {$entry->category}
	</div>
{/if}
{if $entry->author}
	<div id="NewsPostDetailAuthor">
		{$author_label} {$entry->author}
	</div>
{/if}

<div id="NewsPostDetailContent">
	{eval var=$entry->content}
</div>

{if $entry->extra}
	<div id="NewsPostDetailExtra">
		{$extra_label} {$entry->extra}
	</div>
{/if}

<div id="NewsPostDetailPrintLink">
	{$entry->printlink}
</div>
{if $return_url != ""}
<div id="NewsPostDetailReturnLink">{$return_url}</div>
{/if}

{if isset($entry->fields)}
  {foreach from=$entry->fields item='field'}
     <div class="NewsDetailField">
        {if $field->type == 'file'}
	  {* this template assumes that every file uploaded is an image of some sort, because News doesn't distinguish *}
          <img src="{$entry->file_location}/{$field->value}"/>
        {else}
          {$field->name}: {eval var=$field->value}
        {/if}
     </div>
  {/foreach}
{/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 - عربي - 日本語 简体中文

User Handbook/Admin Panel/Content/News/Templates/fr

From CMSMS

A2 Hosting