0

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!

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by cmhampton
0

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.

0

cmhampton,

thanks for your help. This code worked perfectly.

Thanks again.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.