Page 1 of 1

[SOLVED] News Module Title List

Posted: Wed Feb 23, 2011 2:40 am
by dayrinni
You know when you ask where something is and you find it 1 second later? That just happened to me.

I had to make a new SUMMARY Template...that did the trick.



Hello,

I am using the normal News Module that comes with 1.9.3 CMS.

I am trying to add a listing of the last 3 or 4 news posts that contains only the titles with links that you can click to view in the main section of the website.

I am really unsure on how to do this. I have tried a few things but it does not seem to work very well.
For example, here is one:

Code: Select all

<div id="news">
                <h2>News</h2>
                <h3>Recent articles</h3>
                {
                  news number='1' 
                  browsecat="1" 
                  sortby="news_date"
                }
               <br class="spacer" />
		</div>
This just displayed the categories I created and not the actual news items. If I remove the browsecat 1 tag, it will display the text of the most current news post.

Another thing I tried to do it was, I created a new Detail Template called "Test" and in it, I just put "Test". Then I had the news module use the new template as the detailtemplate but nothing happened - it was still behaving as if the detailtemplate was not changed.

I suspect I need to create something that simply displays the title of the news item, but I'm a little hazy.

Forgive me, I'm not a master at websites but thanks for your help here.

Re: [SOLVED] News Module Title List

Posted: Wed Feb 23, 2011 7:21 am
by Marijus
Put this line into page template

Code: Select all

{news number="5" summarytemplate="links2"} 
And add template into new module
summary template "links2":

Code: Select all

{foreach from=$items item=entry}
<div class="NewsSummary">
     {if $entry->postdate}
	  <div class="NewsSummaryPostdate">
		{$entry->postdate|cms_date_format}
	  </div>
      {/if}

<div class="NewsSummaryLink">
     <a href="{$entry->moreurl}" title="{$entry->title|cms_escape:htmlall}">{$entry->title|cms_escape}</a>
</div>

</div>
{/foreach}