Page 1 of 1

Display news depending what page is being viewed

Posted: Wed Feb 27, 2008 8:38 pm
by thebruce
Hi,

I guess this is a documentation question also.

I'm looking for a list of all of the functions/methods/variables etc that each object has. i.e. if $content has a ->title variable accessable etc. Where can I find this? I couldn't find it in the API  ???

Basically what I'm trying to do in a template is:

Code: Select all

{if $entry->title == "Home"}
      {* Start News *}
      <div id="news">
         <h2>News</h2>
          {news number='2' detailpage='news'}
      </div>
      {* End News *}
{/if}
but I don't know if the title object supports that.

Any hints?

Re: Display news depending what page is being viewed

Posted: Wed Feb 27, 2008 9:42 pm
by cyberman
You can use the tag {get_template_vars} to get a list for all Smarty variables available on a page.

If variable is an array you can use php function print_r as modifier to show the elements of the array (e.g. {$entry|print_r}).

Re: Display news depending what page is being viewed

Posted: Thu Feb 28, 2008 9:04 pm
by thebruce
Thanks, that got me on my way.

Re: Display news depending what page is being viewed

Posted: Fri Feb 29, 2008 4:51 am
by Dr.CSS
Or you could add a second content block then in the page add the news tag and give CSS to news not div of content block...