Description (title attribute)

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
point4design
Forum Members
Forum Members
Posts: 68
Joined: Wed Aug 15, 2007 8:11 pm

Description (title attribute)

Post 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!
Zoorlat

Re: Description (title attribute)

Post by Zoorlat »

Smarty is your friend.

Use something like:

Code: Select all

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

/Z
MarkFresh

Re: Description (title attribute)

Post 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
point4design
Forum Members
Forum Members
Posts: 68
Joined: Wed Aug 15, 2007 8:11 pm

Re: Description (title attribute)

Post 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.
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Description (title attribute)

Post 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>
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
MarkFresh

Re: Description (title attribute)

Post by MarkFresh »

Thank you both for your help.
Post Reply

Return to “CMSMS Core”