Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
Title Tag

 

 


dustindd
User

Mar 12, 2010, 11:39 AM

Post #1 of 10 (2360 views)
Shortcut
Title Tag Can't Post

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


Donna
Staff


Mar 12, 2010, 3:36 PM

Post #2 of 10 (2352 views)
Shortcut
Re: [dustindd] Title Tag [In reply to] Can't Post

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

(This post was edited by chris on Mar 12, 2010, 4:19 PM)


dustindd
User

Mar 15, 2010, 12:04 PM

Post #3 of 10 (2336 views)
Shortcut
Re: [Donna] Title Tag [In reply to] Can't Post

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


Donna
Staff


Mar 15, 2010, 3:13 PM

Post #4 of 10 (2331 views)
Shortcut
Re: [dustindd] Title Tag [In reply to] Can't Post

Hi Dustin,

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

Donna

--
support@interactivetools.com


dustindd
User

Mar 15, 2010, 3:32 PM

Post #5 of 10 (2329 views)
Shortcut
Re: [Donna] Title Tag [In reply to] Can't Post

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

Follow Me On Twitter: http://www.twitter.com/dustindd
Attachments: news.php (17.5 KB)


Donna
Staff


Mar 15, 2010, 5:05 PM

Post #6 of 10 (2326 views)
Shortcut
Re: [dustindd] Title Tag [In reply to] Can't Post

Hi Dustin!

Make sure the code from CMS Builder is right at the top of the page. Where it says "Step 1" that should be at the VERY top, before anything else (even before your doctype declaration.)

The title isn't showing because it doesn't know where to grab it from -- the PHP works "in order" from top to bottom of the page, so anything above that code block won't show.

I hope this helps. :)

Donna

--
support@interactivetools.com


dustindd
User

Mar 15, 2010, 11:26 PM

Post #7 of 10 (2321 views)
Shortcut
Re: [Donna] Title Tag [In reply to] Can't Post

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.php (17.5 KB)


aev
User

Mar 16, 2010, 2:41 AM

Post #8 of 10 (2316 views)
Shortcut
Re: [dustindd] Title Tag [In reply to] Can't Post

 
Try this..

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

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

-aev-


Donna
Staff


Mar 16, 2010, 3:57 PM

Post #9 of 10 (2308 views)
Shortcut
Re: [dustindd] Title Tag [In reply to] Can't Post

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


dustindd
User

Mar 16, 2010, 9:21 PM

Post #10 of 10 (2301 views)
Shortcut
Re: [Donna] Title Tag [In reply to] Can't Post

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