Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin Tips & Tricks
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
description for meta and bookmarksite on showthread
Zachariah's Avatar
Zachariah
Join Date: Feb 2002
Posts: 2,125

AS Electronics Experance in PHP, HTML, JavaScript, DHTML, Flash, XML, MySQL, Photoshop, more. Electronics I, II, III, Microprocessors, AC and DC Electronics, Boolean Algebra, Trig / Math Analysis, Chemistry / AP Physics

Canoga Park, CA
Show Printable Version Email this Page Subscription
Zachariah Zachariah is offline 03-17-2009, 10:00 PM

Hello,
I took on a task to make bookmarksite operate with a few more features and ended up also creating data for meta description. The code needs some optimization, but you will get the idea.

The point was to get "pagetext" data from the 1st post in the thread to display on showthread.php.

In file includes\function.php, find function: " fetch_threadinfo"

FIND:
PHP Code:
SELECT IF(visible 210) AS isdeleted
REPLACE WITH:
PHP Code:
SELECT IF(thread.visible 210) AS isdeleted
ABOVE:
PHP Code:
thread.* 
Add:
PHP Code:
" . iif($vbulletin->options['threadpreview'] > 0 AND THIS_SCRIPT == 'showthread', 'post.pagetext AS preview, ') . " 
ABOVE:
PHP Code:
$tachyjoin 
Add:
PHP Code:
" . iif($vbulletin->options['threadpreview'] > 0 AND THIS_SCRIPT == 'showthread', "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid thread.firstpostid)") . " 
BELOW:
PHP Code:
WHERE thread.threadid $threadid 
        
"); 
Add:
PHP Code:
if($vbulletin->options['threadpreview'] > AND THIS_SCRIPT == 'showthread'
    { 
    
$threadcache["$threadid"]['preview'] = strip_quotes($threadcache["$threadid"]['preview']);
    
$threadcache["$threadid"]['preview'] = preg_replace ('/\n(\s*)/'" "$threadcache["$threadid"]['preview']);
    
$threadcache["$threadid"]['preview'] = preg_replace ('/\r(\s*)/'" "$threadcache["$threadid"]['preview']);
    
$threadcache["$threadid"]['preview'] = str_replace("  "" "$threadcache["$threadid"]['preview']);
    
$threadcache["$threadid"]['preview'] = htmlspecialchars_uni(fetch_censored_text(fetch_trimmed_title(strip_bbcode($threadcache["$threadid"]['preview'], falsetrue), $vbulletin->options['threadpreview'])));

This will create $threadinfo['preview'] within showthread.php.
- This value can be added to the meta tag description in the $headerinclude to give each thread something other than $thread['title'].

We can also edit showthread.php

Find:
PHP Code:
        $bookmarksite['link'] = str_replace(
            array(
'{URL}''{TITLE}'),
            array(
urlencode($vbulletin->options['bburl'] . '/showthread.php?t=' $thread['threadid']), urlencode($thread['title'])),
            
$bookmarksite['url']
        ); 
Replace:
PHP Code:
        $bookmarksite['link'] = str_replace(
            array(
'{URL}''{TITLE}''{DESCRIPTION}'),
            array(
urlencode($vbulletin->options['bburl'] . '/showthread.php?t=' $thread['threadid']), urlencode($thread['title']), urlencode($thread['preview'])),
            
$bookmarksite['url']); 
This will allow {DESCRIPTION} to be added to be added to submitting bookmark URL's to fill out the textarea on submission vs. copy and paste.

EX: Digg
Code:
http://digg.com/submit?phase=2&url={URL}&title={TITLE}&bodytext={DESCRIPTION}
Reply With Quote
  #2  
Old 07-09-2009, 07:57 PM
viper357's Avatar
viper357 viper357 is offline
 
Join Date: Dec 2006
Location: Worthing, UK
Posts: 563
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this work on 3.6.12?
Reply With Quote
  #3  
Old 07-09-2009, 08:20 PM
HMBeaty's Avatar
HMBeaty HMBeaty is offline
 
Join Date: Sep 2005
Posts: 4,141
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Possibly since its just PHP edits. You would just need to make a backup of your files in case one of these lines doesn't coincide with the 3.6.12 files
Reply With Quote
  #4  
Old 09-05-2009, 02:09 AM
abdobasha2004's Avatar
abdobasha2004 abdobasha2004 is offline
 
Join Date: Aug 2008
Posts: 541
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

WOW !!
this is what I am search ing about
I will try
if it work you should have the Nobel prize in coding

--------------- Added [DATE]1252121513[/DATE] at [TIME]1252121513[/TIME] ---------------

sorry it did not work
plz revise it
plz I need it so much
Reply With Quote
  #5  
Old 09-06-2009, 06:00 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Did you then add something to your meta tags in headinclude? Exactly what did you add there?
Reply With Quote
  #6  
Old 09-06-2009, 11:14 PM
abdobasha2004's Avatar
abdobasha2004 abdobasha2004 is offline
 
Join Date: Aug 2008
Posts: 541
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

ofcourse i did
I put the
$thread['preview']
in meta description
may code is :
<if condition="$show['threadinfo']">
<meta name="keywords" content="<if condition="$threadinfo['taglist']">$threadinfo[taglist], </if>$foruminfo[forumkeywords], $threadinfo[prefix_plain_html] $threadinfo[title]"/>
<meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$thread[preview],$threadinfo[prefix_plain_html] $threadinfo[title] من $foruminfo[title_clean]" />

IT DID NOT WORK
Reply With Quote
  #7  
Old 09-07-2009, 03:38 AM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You need to use the variable $threadinfo, not $thread.
Reply With Quote
  #8  
Old 09-07-2009, 01:58 PM
Zachariah's Avatar
Zachariah Zachariah is offline
 
Join Date: Feb 2002
Location: Canoga Park, CA
Posts: 2,125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Fixed
- Thanks Lynne for the heads up on the typeo
Reply With Quote
  #9  
Old 09-07-2009, 02:46 PM
abdobasha2004's Avatar
abdobasha2004 abdobasha2004 is offline
 
Join Date: Aug 2008
Posts: 541
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it worked like a charm using $threadinfo[preview] :up::up:

THANKS Lynne
THANKS Zachariah

THANKS A LOT , you do not know how desprate I was to make this happen
you may know lynn Because of my "duplicates"
Reply With Quote
  #10  
Old 09-19-2009, 02:38 AM
MagicThemeParks's Avatar
MagicThemeParks MagicThemeParks is offline
 
Join Date: Sep 2009
Posts: 850
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Was having a little trouble until I noticed this post on another thread :up:

https://vborg.vbsupport.ru/showpost....1&postcount=10
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:11 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06490 seconds
  • Memory Usage 2,330KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (10)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (1)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete