472,114 Members | 2,191 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,114 software developers and data experts.

Readin page title from db and outputting to web page

Hi

Please be very gentle! I am not a programmer! I have a question which I'm sure you'll all think is very easy. I have a directory which writes out categories from a db. When you click on a category, whatever links are in that category are written out to the web page. I can add or delete categories etc. What I want to know is how to change the 'TITLE' of the asp page to the actual category name. At the moment on categories.asp the page title is Categories. When I click on a category the web page changes and the query result is ouput to the website - but the page title is still 'Categories'. I want to change the 'Categories' title to the actual category I'm in. Do I need to create a new field in the db so asp/vbscript can read and ouput from that?

Thanks

Ian
Mar 15 '07 #1
1 1054
jhardman
3,406 Expert 2GB
Hi

Please be very gentle! I am not a programmer! I have a question which I'm sure you'll all think is very easy. I have a directory which writes out categories from a db. When you click on a category, whatever links are in that category are written out to the web page. I can add or delete categories etc. What I want to know is how to change the 'TITLE' of the asp page to the actual category name. At the moment on categories.asp the page title is Categories. When I click on a category the web page changes and the query result is ouput to the website - but the page title is still 'Categories'. I want to change the 'Categories' title to the actual category I'm in. Do I need to create a new field in the db so asp/vbscript can read and ouput from that?

Thanks

Ian
This seems like a pretty easy problem, and I think I've done something like that a couple of times. My first question is when you say "title" are you referring to the actual [HTML]<title>categories</title>[/HTML] or a page header [HTML]<h1>Categories</h1>[/HTML] ?

My second question is, is there already a field in the database that has the info you want? Or if not, is there a simple logical statement from which you can derive the info? If either of these is true, you don't need to add a new field to the database.

Example of a logical statement:
Expand|Select|Wrap|Line Numbers
  1. if request("category") = "toothpaste" then
  2.    response.write "<h1>Toothpaste - make your teeth gleam!</h1>"
  3. elseif request("category") = "deoderant" then
  4.    response.write "<h1>Deoderant - smell like a star!</h1>"
  5. end if
If the field already exists in the database that has the exact phrasing you want, then you just need to say:

Expand|Select|Wrap|Line Numbers
  1. <h1><%= objRS("categoryName") %></h1>
of course you need to refer to the database connection as it is already done on your page. If this looks nothing like what is already on your page, post your code and you may get a better response.

There is a good asp database connection tutorial at w3schools.com
Mar 16 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

13 posts views Thread by mark | last post: by
8 posts views Thread by Dynamo | last post: by
5 posts views Thread by Jeremy Ames | last post: by
6 posts views Thread by scottyman | last post: by
11 posts views Thread by Victor Lagerkvist | last post: by
2 posts views Thread by Stuartsblog | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.