Page 1 of 1

news only on frontpage

Posted: Thu Mar 15, 2007 6:44 pm
by kengu
I feel a bit stupid because I know there is some kind of simple way of doing this but I just cannot figure out where.

I have CMSMS 1.0.4 and I would like to use only one template on all pages and for that I need a way to put news items from NEWS-module (2.2) only on frontpage. The functionality I am looking for is something as described below

Code: Select all

if (page == frontpage) {

  echo '<div id="extras">\n';
  {cms_module module="news" number="2"}
  echo '</div>\n';
} else {
  echo '<div id="zip"></div>';
}
The problem is that where and how do I get the "frontpage" to figure out which page is the frontpage and with what to compare it.

Re: news only on frontpage

Posted: Thu Mar 15, 2007 6:52 pm
by RonnyK

Code: Select all

{if $node->id == 1}
  //lyour logic
{/if}
based on your pageid .

Ronny

Re: news only on frontpage

Posted: Thu Mar 15, 2007 8:18 pm
by kengu
Well actually that didn't work because it took the last node from my menu but inspired by that I figured out a way:

Code: Select all

{if $friendly_position == 1}

<div id="extras">
{cms_module module="news" number="2"}
</div>

{/if}
And {get_template_vars} is a good way to figure out the variables available in template. I could have used also some other variable in comparation but well.. that friendly_position one works just fine.