Page 1 of 1

[solved] Created news title visible to body section

Posted: Mon Jul 15, 2013 5:16 am
by urheat
I'm confused, so hopefully someone could point my error.

I have managed to do this a few times, but almost every time I get stuck and now I just can't figure out, what's wrong.

In news detail template I have created variable:

Code: Select all

{assign var='news_title' value=$entry->title}
In page template I use it when creating a page title:

Code: Select all

{if isset($news_title)}
{capture assign='createdTitle'}{$news_title} - {sitename}{/capture}
{else}
{capture assign='createdTitle'}{title} - {sitename}{/capture}
{/if}
<title>{$createdTitle}</title>
But if I try to use $news_title in the body section, it is null. For example with following code, it always show "title" - not "news_title":

Code: Select all

<h1>
{if isset($news_title)}
  {$news_title}
{else}
  {title}
{/if}
</h1>
What I'm missing?

Re: Created news title visible to body section

Posted: Mon Jul 15, 2013 6:40 am
by Rolf
Let Smarty process your content block:

In the very top of your html template
{content assign='maincontent'}

In the body
{$maincontent}

Re: Created news title visible to body section

Posted: Mon Jul 15, 2013 11:05 am
by urheat
Thanks! That was it.