<meta name="description" content=

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ukbill69
    Senior Member
    • Mar 2002
    • 101

    <meta name="description" content=

    Hello,

    I was wondering if there was a way to add in <meta name="description" content="thread information" />

    The thread information or what information is on that page?

    Can anyone help me?
    Kind Regards
    Bill
  • Jake Bunce
    Senior Member
    • Dec 2000
    • 46598
    • 3.6.x

    #2
    These instructions will put the content of the first post of the thread into the meta description.

    Go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> PHP Include Code Templates -> phpinclude_start

    Add this code to that template:

    PHP Code:
    if (THIS_SCRIPT == 'showthread')
    {
        
    $thread_description $DB_site->query_first("SELECT pagetext
            FROM " 
    TABLE_PREFIX "post
            WHERE threadid = 
    $threadid
            ORDER BY postid
            ASC
            LIMIT 1"
    );

        
    $thread_description[pagetext] = htmlspecialchars($thread_description[pagetext], ENT_QUOTES);

    Then go to your:

    Admin CP -> Styles & Templates -> Style Manager -> « » -> headinclude

    Replace the red code with $thread_description[pagetext]:

    Code:
    <meta http-equiv="Content-Type" content="text/html; charset=$stylevar[charset]" />
    <meta name="generator" content="vBulletin $versionnumber" />
    <meta name="keywords" content="$vboptions[keywords]" />
    <meta name="description" content="[color=red]$vboptions[description][/color]" />

    Comment

    • ukbill69
      Senior Member
      • Mar 2002
      • 101

      #3
      Many thanks jake, you have been a great help.
      Kind Regards
      Bill

      Comment

      • ukbill69
        Senior Member
        • Mar 2002
        • 101

        #4
        One thing that worries me that when i view the html comes out like this:

        <meta name="description" content="I recieved this in an e-mail a few weeks back, I thought it was pretty good

        Does it matter that there is no " /> at the end
        Kind Regards
        Bill

        Comment

        • ukbill69
          Senior Member
          • Mar 2002
          • 101

          #5
          Donty worry i havent looked over the html. It has just on another line that why i could see it lol. Many thanks.
          Kind Regards
          Bill

          Comment

          • poolking
            Senior Member
            • Aug 2002
            • 2061

            #6
            To be XHTML compliant then you will need the />

            Comment

            • SoberRecovery
              Member
              • Jul 2002
              • 51
              • 3.0.1

              #7
              Getting a blank in my description, Jake. Any ideas???

              Online Support Groups for Addicts, Alcoholics and their Family, Friends and Loved Ones.
              Have A Great 24...
              SoberRecovery.com

              Comment

              • SoberRecovery
                Member
                • Jul 2002
                • 51
                • 3.0.1

                #8
                Check on that. I am actually getting a HUGE description. Any way to limit the characters???
                Have A Great 24...
                SoberRecovery.com

                Comment

                • Jake Bunce
                  Senior Member
                  • Dec 2000
                  • 46598
                  • 3.6.x

                  #9
                  Originally posted by SoberRecovery
                  Check on that. I am actually getting a HUGE description. Any way to limit the characters???
                  Yes. In your phpinclude_start code, add the red code as shown below:

                  Code:
                  if (THIS_SCRIPT == 'showthread') 
                  { 
                      $thread_description = $DB_site->query_first("SELECT pagetext 
                          FROM " . TABLE_PREFIX . "post 
                          WHERE threadid = $threadid 
                          ORDER BY postid 
                          ASC 
                          LIMIT 1"); 
                  
                      $thread_description[pagetext] = htmlspecialchars($thread_description[pagetext], ENT_QUOTES); 
                  
                      [color=red]$thread_description[pagetext] = substr($thread_description[pagetext], 0, X); [/color]
                  }
                  Where X is the max number of characters. Everything after X characters will be truncated from the description.

                  Comment

                  • SoberRecovery
                    Member
                    • Jul 2002
                    • 51
                    • 3.0.1

                    #10
                    Thanks Jake!!!
                    Have A Great 24...
                    SoberRecovery.com

                    Comment

                    • SoberRecovery
                      Member
                      • Jul 2002
                      • 51
                      • 3.0.1

                      #11
                      Jake, after adding the limiter code, I began getting errors. The thread is here:


                      Database error in vBulletin 3.0.1:Invalid SQL: SELECT pagetext FROM post WHERE threadid = ORDER BY postid ASC LIMIT 1mysql error: You have an error in your SQL syntax near 'ORDER BY postid ASC LIMIT 1' at line 4 Help Please???
                      Have A Great 24...
                      SoberRecovery.com

                      Comment

                      • Jake Bunce
                        Senior Member
                        • Dec 2000
                        • 46598
                        • 3.6.x

                        #12
                        Can you post a link to a page with the error?

                        If you send me a private message with a URL and admin login for your forums then I can probably find the problem more quickly.

                        Comment

                        • Jake Bunce
                          Senior Member
                          • Dec 2000
                          • 46598
                          • 3.6.x

                          #13
                          (the code works fine on my forums)

                          Comment

                          • SoberRecovery
                            Member
                            • Jul 2002
                            • 51
                            • 3.0.1

                            #14
                            PM sent. Jake-thanks for all of your hard work.
                            Have A Great 24...
                            SoberRecovery.com

                            Comment

                            • Jake Bunce
                              Senior Member
                              • Dec 2000
                              • 46598
                              • 3.6.x

                              #15
                              Apparently $threadid is not defined for all showthread pages. Try adding the red code:

                              Code:
                              if (THIS_SCRIPT == 'showthread' [color=red]AND $threadid[/color]) 
                              { 
                                  $thread_description = $DB_site->query_first("SELECT pagetext 
                                      FROM " . TABLE_PREFIX . "post 
                                      WHERE threadid = $threadid 
                                      ORDER BY postid 
                                      ASC 
                                      LIMIT 1"); 
                              
                                  $thread_description[pagetext] = htmlspecialchars($thread_description[pagetext], ENT_QUOTES); 
                              
                                  $thread_description[pagetext] = substr($thread_description[pagetext], 0, X); 
                              }

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...