[solved] Created news title visible to body section

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am

[solved] Created news title visible to body section

Post 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?
Last edited by urheat on Mon Jul 15, 2013 11:05 am, edited 1 time in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Contact:

Re: Created news title visible to body section

Post by Rolf »

Let Smarty process your content block:

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

In the body
{$maincontent}
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
urheat
Forum Members
Forum Members
Posts: 243
Joined: Sat Oct 17, 2009 6:50 am

Re: Created news title visible to body section

Post by urheat »

Thanks! That was it.
Post Reply

Return to “CMSMS Core”