Readin page title from db and outputting to web page

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • iancrabby
    New Member
    • Mar 2007
    • 1

    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
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by iancrabby
    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>categori es</title>[/HTML] or a page header [HTML]<h1>Categorie s</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:
    Code:
    if request("category") = "toothpaste" then
       response.write "<h1>Toothpaste - make your teeth gleam!</h1>"
    elseif request("category") = "deoderant" then
       response.write "<h1>Deoderant - smell like a star!</h1>"
    end if
    If the field already exists in the database that has the exact phrasing you want, then you just need to say:

    Code:
    <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

    Comment

    Working...