Title Tag

10 posts by 3 authors in: Forums > CMS Builder
Last Post: March 16, 2010   (RSS)

By dustindd - March 12, 2010

Is there a way to generate the title of a page (for example an article title) as the title tag using CMS Builder? Example: http://www.dustindrorbaugh.com/html/news.php?Sears-Scrambles-Online-for-a-Lifeline-2 would have the title tag of Sears Scrambles Online for a Lifeline.

Dustin
Dustin Drorbaugh
http://www.DustinDrorbaugh.com

Follow Me On Twitter: http://www.twitter.com/dustindd

Re: [dustindd] Title Tag

By Donna - March 12, 2010 - edited: March 12, 2010

Hi Dustin!

You bet. Just put your title code into the <title> tag. So, you'd have something like this:

<title><?php echo htmlspecialchars($mainRecord['title']) ?></title>

Let me know if that works for you. :)
Donna

--
support@interactivetools.com

Re: [Donna] Title Tag

By dustindd - March 15, 2010

Hi Donna,

That did not work. Instead of the article title being displayed the entire URL of the file is displayed. I attached my php file if you want to take a quick look.
Dustin Drorbaugh
http://www.DustinDrorbaugh.com

Follow Me On Twitter: http://www.twitter.com/dustindd

Re: [dustindd] Title Tag

By Donna - March 15, 2010

Hi Dustin,

It doesn't look like the file got attached, can you try that again?
Donna

--
support@interactivetools.com

Re: [Donna] Title Tag

By dustindd - March 15, 2010

www.dustindrorbaugh.com/news.zip
Dustin Drorbaugh
http://www.DustinDrorbaugh.com

Follow Me On Twitter: http://www.twitter.com/dustindd
Attachments:

news.php 18K

Re: [Donna] Title Tag

By dustindd - March 16, 2010

Hey Donna.

I'm getting a notice "Undefined variable mainRecord in -home-dustindd-public_html-html-news.php on line 23" and I moved the first section of php code to the very top. This is not adding up. I just want the title of the article to be displayed in the <title> tags.
Dustin Drorbaugh
http://www.DustinDrorbaugh.com

Follow Me On Twitter: http://www.twitter.com/dustindd
Attachments:

news_001.php 18K

Re: [dustindd] Title Tag

By aev - March 16, 2010


Try this..

Change:
<title><?php echo htmlspecialchars($mainRecord['title']) ?></title>

To:
<title><?php echo htmlspecialchars($newsRecord['title']) ?></title>

-aev-

Re: [dustindd] Title Tag

By Donna - March 16, 2010

Hi Dustin,

Yup, what aev said -- with any examples we give, make sure you change any variables (like the section names) to match your own. You can compare against the code from your code generator -- all this is is the bit of echo code for the "title" field. :)
Donna

--
support@interactivetools.com

Re: [Donna] Title Tag

By dustindd - March 16, 2010

Yes aev's solution worked. Thank you for your help!
Dustin Drorbaugh
http://www.DustinDrorbaugh.com

Follow Me On Twitter: http://www.twitter.com/dustindd