Page 1 of 1

Can't figure out news listing [solved]

Posted: Sat Jan 10, 2009 3:02 am
by jillc
I'm sorry to be asking such dumb questions. Firstly when I copied a template, I found the following:
     {* Start News *}
     
         News
          {news number='3' detailpage='news'}
     
      {* End News *}

In the News help pages it has: (optional) detailpage="pagealias" - Page to display News details in. etc

So why does the original template use single quotes for number='3' but the help page uses double quotes for everything. Are these interchangeable or is one preferable to the other?

I have tried a number of different settings but I just can't get my head around this. I have set up a new category in news. I want to display just this category on a page. At the moment I have a News box under the left navigation, and my page calls in this news category. But in both cases, the category name and the author is listed. What I want is a list of all the articles in this category in the news box and then the summaries displayed in the content area with [more] links. Then the page which displays the full text doesn't need to repeat the category name or author or anything else either.

How can I achieve this?

Re: Can't figure out news listing

Posted: Sat Jan 10, 2009 7:17 pm
by Dr.CSS
Yes the single and dbl. quotes don't matter...

Most of what you want to do is adjustable/done in the News templates and the tag call parameters...

{news category="" browsecattemplate=""}

This is shown in the Help...

Re: Can't figure out news listing

Posted: Sun Jan 11, 2009 9:39 am
by jillc
I'm sure it's easy when you know HOW. When you don't know how the help files leave a lot out ... such as examples!

Perhaps I'm trying to do something which can't be done. I made a summary template for the news which only displays the title, without author and category. I made a detail template and removed the same author and category bits. I created a new page template and called in the news by category. When I go to that page it shows my list of titles in the news box under the navigation. It shows exactly the same list in the content section - I actually want this to show the summary. If I click on the link from the content section it takes me to the full text. However, if I click on the link from the News box listing, it takes me to a page detailing the author and category again. Why????

I don't know why there isn't a tutorial for the news module - if I could figure this one out the rest should sort of follow, shouldn't they?

What I want:
A list of the article titles (clickable)
A page showing the titles & summary + [more]
A detail page

Is this not possible? What a pity you don't have any proper tutorials.

Re: Can't figure out news listing

Posted: Mon Jan 12, 2009 12:47 am
by Dr.CSS
A link to what you have would be most helpful...

When you make a new news template say detail and you don't have it as the only template and it's not set as default then you need to call it in the news tag detailtemplate="nameofit"...

The tags you use would be nice also...

Re: Can't figure out news listing

Posted: Mon Jan 12, 2009 9:24 am
by jillc
Well, here goes. URL http://www.westozwebdesign.com.au/ and I'm working on the page called Profiles1.

Page is based on a template with the following:

Code: Select all

    {* Start News *}
      <div id="news">
         <h2>Member Profiles</h2>
          {news category="profiles*" summarytemplate="profiles"}
      </div>
      {* End News *}
Profiles1 content consists of

Code: Select all

{news category="profiles" detailtemplate="profiles" summarytemplate="profiles" detailpage="page detail"}
I have a news summary template called profiles

Code: Select all

<!-- Start News Display Template -->
{if $pagecount > 1}
  <p>
{if $pagenumber > 1}
{$firstpage} {$prevpage} 
{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
 {$nextpage} {$lastpage}
{/if}
</p>
{/if}
{foreach from=$items item=entry}
<div class="NewsSummary">


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




{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 -->
I have a News Detail template

Code: Select all

{if $entry->formatpostdate}
	<div id="NewsPostDetailDate">
		{$entry->formatpostdate}
	</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}


<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}
Thanks.
Jill.

Re: Can't figure out news listing

Posted: Mon Jan 12, 2009 9:26 pm
by Dr.CSS
OK, these aren't going to include anything but the least you need to do it, no next/prev. links etc...

1) To get just article title links...
{foreach from=$items item=entry}


{$entry->titlelink}


{/foreach}

2) To get title link and summary with more link...
{foreach from=$items item=entry}


{$entry->titlelink}

{if $entry->summary}

{eval var=$entry->summary}


[{$entry->morelink}]


{/foreach}

The morelink doesn't work unless there is a summary..

3) When you use the detailpage= you need the page alias, in your case it would be page-detail, and you may, just to keep it uniform, put the summarytemplate= call first...

Re: Can't figure out news listing [solved]

Posted: Tue Jan 13, 2009 2:09 am
by jillc
Okay, I was half way there. Finally realised that I needed TWO summary templates in the news module - 1 for the "news" block and 1 for the content section.

My template for the page needed to call in the summarytemplate and the detailtemplate in order for the links from the "news" block to reach the right template.

The CONTENT of the page needed to call in the 2nd summary template as well as call in the correct detailtemplate.