943,867 Members | Top Members by Rank

Ad:
  • ColdFusion Discussion Thread
  • Marked Solved
  • Views: 2003
  • ColdFusion RSS
Jun 20th, 2008
0

title tag

Expand Post »
I use a page that pulls the content from a database, including the title of the document. How can I make that title to also be the browser title (content in the title tag)?

Thanks!
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jstama is offline Offline
3 posts
since Mar 2008
Jun 23rd, 2008
0

Re: title tag

Here's one way:

Get your db information before you output the <head> tag on your page.

Inside the <title> tag, output the info from your query. For example:

ColdFusion Syntax (Toggle Plain Text)
  1. <cfquery datasource="dsn" name="pageData">
  2. SELECT
  3. *
  4. FROM
  5. pageContent
  6. WHERE
  7. pageID = #pageID#
  8. </cfquery>
  9.  
  10. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  11. <html xmlns="http://www.w3.org/1999/xhtml">
  12. <head>
  13. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  14. <title><cfoutput>#pageData.Title#</cfoutput></title>
  15. </head>

Obviously, replace the query with your own, but you get the general idea?

Let me know if you need more help.
Reputation Points: 23
Solved Threads: 10
Junior Poster in Training
cmhampton is offline Offline
79 posts
since Feb 2008
Jun 28th, 2008
0

Re: title tag

cmhampton,

thanks for your help. This code worked perfectly.

Thanks again.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
jstama is offline Offline
3 posts
since Mar 2008
Jun 29th, 2008
0

Re: title tag

I'm glad I could help. Please mark the thread solved.
Reputation Points: 23
Solved Threads: 10
Junior Poster in Training
cmhampton is offline Offline
79 posts
since Feb 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ColdFusion Forum Timeline: Get values
Next Thread in ColdFusion Forum Timeline: Insert query.





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC