Page 1 of 1

Description (title attribute)

Posted: Sun Dec 07, 2008 11:35 pm
by point4design
Hi,

I'm running the latest CMSmadesimple and love it. I have a question about the title that shows in the tag of my site. I want to use the Description (title attribute): that is found under options. So I've made the change to my template. But if I don't enter anything in the Description (title attribute) area then I want it to revert and use the Title: found under the 'Main' tab in the admin. What code would I put in my template to do this. If Description (title attribute): is there show it, if not show Title:. Thanks!

Re: Description (title attribute)

Posted: Mon Dec 08, 2008 1:07 am
by Zoorlat
Smarty is your friend.

Use something like:

Code: Select all

{if $variable neq ''}
   {$variable}
{else}
   {title}
{/if}
hope this helps.

/Z

Re: Description (title attribute)

Posted: Fri Jan 23, 2009 6:05 pm
by MarkFresh
Sorry for being thick but should it be :

Code: Select all

 {if description neq ''}
   {description}
{else}
   {title}
{/if}  
inside the tags on the template?

It causes an error for me

Thanks

Mark

Re: Description (title attribute)

Posted: Fri Jan 23, 2009 6:24 pm
by point4design
I ended up editing the plugins/function.description.php to do what I needed. It checks to see if there's a description and uses that otherwise it uses the title. Just put {description} in your template where you want to use it. Copy of the file is attached.

Re: Description (title attribute)

Posted: Fri Jan 23, 2009 6:51 pm
by calguy1000
Reading the help for the tags, and the smarty manual helps:

Code: Select all

{capture assign='tmp'}{description}{/capture}
{if empty($description)}
   {title assign='tmp'}
{/if}
<title>{$tmp}</title>

Re: Description (title attribute)

Posted: Mon Jan 26, 2009 3:14 pm
by MarkFresh
Thank you both for your help.