Location: PHPKode > projects > Saurus CMS > extensions/saurus4/content_templates/news_list.html
{**
 * Articles as news with archive, content template
 * Date: 10.10.08
 *
 * @package saurus4
 * 
 * @author Saurus <hide@address.com>
 *
 *}

<div id="NewsListContainer">

{* show configuration area for editor *}
{if $in_editor}

{* save configuration *}
{if $smarty.get.save}
	{custom_conf_save id=$id open_news=$smarty.get.open_news total_news=$smarty.get.total_news}
{/if}
{* /save configuration *}

{* load configuration *}
{custom_conf_load id=$id name="tpl_conf"}

<form name="custom_conf_vars" action="{$self}" method="GET">
	<fieldset>
		<legend>Settings</legend>

		<table cellpadding="2" cellspacing="2">
			<tr>
				<td><label>Open articles:</label></td>
				<td><input type="text" name="open_news" value="{$tpl_conf.open_news|default:1|@htmlspecialchars}"></td>
			</tr>
			<tr>
				<td><label>Number of headlines:</label></td>
				<td><input type="text" name="total_news" value="{$tpl_conf.total_news|default:5|@htmlspecialchars}"></td>
			</tr>
		</table>
		
		<input type="hidden" name="save" value="1">
		<input type="hidden" name="id" value="{$id}">
		
		<input type="submit" value="Save">
		
	</fieldset>
</form>

{* /show configuration area for editor *}
{else}
	{* load configuration *}
	{custom_conf_load id=$id name="tpl_conf"}
{/if}

{* set configuration values or default values *}
{assign var="total_news" value=$tpl_conf.total_news|default:5}
{assign var="open_news" value=$tpl_conf.open_news|default:1}

{* the news list *}
{init_articles name="articles" position=0 limit=$total_news+$open_news order="date desc" buttons="new,edit,hide,delete"}
{$articles_newbutton}

{foreach from=$articles item="article" name="articles_loop"}

	{if $smarty.foreach.articles_loop.iteration <= $open_news}
	{* open news *}
	<h1>{$article->buttons}{if $article->show_headline}{$article->title}{/if}</h1>
	<span class="Date">{$article->date}</span>
	
		{init_article name="art" id=$article->id}
		
		{if $art->lead && $art->body}
			{$art->lead}
			{* Read More link from Glossary *}
			<a href="{$art->href}"><i>{sysword word="More" type="Visual Design"}</i></a>
		{else}
			{$art->lead} {$art->body}
			{if $art->forum_allowed}
				{if $art->comment_count}
					<a href="{$art->href}#comments">{sysword word="comments" type="saurus4"}</a>
					({$art->comment_count})
					|
					<a href="{$art->href}#add_message">{sysword word="add" type="saurus4"}</a>
				{else}
					<a href="{$art->href}#add_message">{sysword word="add comment" type="saurus4"}</a>
				{/if}
			{/if}
		{/if}
	{* /open news *}
	{else}
	{* listed with title news *}
	<p>
		<span class="Date">{$article->date}</span>
		{$article->buttons}
		<a href="{$article->href}">{$article->title}</a>
		{if $article->comment_count}({$article->comment_count}){/if}
	</p>
	{* /listed with title news *}
	{/if}
	
{/foreach}
{* /the news list *}

{* archive link *}
{if $articles_counttotal > $total_news+$open_news}
	<br>
	<a href="?id={$id}&op=archive"><strong>{sysword word="archive" type="saurus4"}</strong></a>
{/if}
{* /archive link *}

</div><!-- / NewsListContainer -->
Return current item: Saurus CMS