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)?
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:
<cfquery datasource="dsn" name="pageData"> SELECT * FROM pageContent WHERE pageID = #pageID# </cfquery> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><cfoutput>#pageData.Title#</cfoutput></title> </head>
Obviously, replace the query with your own, but you get the general idea?
Let me know if you need more help.
thanks for your help. This code worked perfectly.
I'm glad I could help. Please mark the thread solved.