Dynamic page title in AP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • user65
    New Member
    • May 2010
    • 23

    Dynamic page title in AP

    Is it possible to have dynamic page titles with an ASP site? Many people would like to share our content on facebook, but can't do so because the page titles are displayed as the URL.

    I'm not very familiar with ASP, so any help would be greatly appreciated.
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    yes.

    With ASP your script creates the code of the web page. Not just the text of the web page, but the underlying code as well. so it is easy to say
    Code:
    if session(var1) = "current" then
       response.write "<title>A nifty web page</title>" & vbNewLine
    else
       response.write "<title>An ordinary web page</title>" & vbNewLine
    end if 
    
    'or
    
    <title><%=userName%>'s home page</title>
    Let me know if this answers your question.

    Jared

    Comment

    • user65
      New Member
      • May 2010
      • 23

      #3
      Code:
      <title><%=userName%>'s home page</title>
      I am not too familiar with ASP/Microsoft SQL. What should I be looking to replace the userName variable with? Can I use a variable from the database to plug in here?

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        yes, that would work. Using database fields it would look something like this
        Code:
        <title><%=rs("fname") & " " & rs("lname")%>'s home page</title>
        the code <%= %> just prints out the value of whatever variable you put in there.

        At this point, it sounds like there are still several missing pieces of information between you and your final solution, and it is hard for me to see what you are still missing. You might want to check out w3schools.com, they have a fairly broad library of tutorials and examples. Of course you can keep firing your questions at me and I will continue to help answering them.

        Jared

        Comment

        Working...