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
  #12  
Old 10-11-2009, 08:51 PM
KrisP KrisP is offline
 
Join Date: Jun 2002
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

$threadinfo[preview] gives empty result. Have tried modding functions.php 3 times to make sure no typos. Still dosent work. I presume $tachyjoin (is found several places) is the place where it standss alone on the line. 3.7.4 PL

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

For this mod to work "Length of Thread Preview Text" must be greater than zero in Forum DIsplay Options in vboptions.

INSTALLED AND THANKS!!!!
Reply With Quote
  #13  
Old 10-13-2009, 10:34 PM
Zachariah's Avatar
Zachariah Zachariah is offline
 
Join Date: Feb 2002
Location: Canoga Park, CA
Posts: 2,125
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KrisP View Post
For this mod to work "Length of Thread Preview Text" must be greater than zero in Forum DIsplay Options in vboptions.

INSTALLED AND THANKS!!!!
ahh good point, I worked this up on default install of VB and "Length of Thread Preview Text" has a setting.
Reply With Quote
  #14  
Old 10-24-2009, 07:44 PM
KrisP KrisP is offline
 
Join Date: Jun 2002
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Something that would be very nice would be a "bloginfo[preview]" - a meta desription for blogs
Reply With Quote
  #15  
Old 02-26-2010, 03:48 AM
KrisP KrisP is offline
 
Join Date: Jun 2002
Posts: 169
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

.......
Reply With Quote
  #16  
Old 01-12-2011, 02:27 PM
sivaganeshk sivaganeshk is offline
 
Join Date: Oct 2010
Posts: 250
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

should I make changes in vb 4.1.1 version or made it default ?
Reply With Quote
  #17  
Old 09-27-2011, 10:07 AM
asd_ra7la asd_ra7la is offline
 
Join Date: May 2008
Posts: 25
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks
Reply With Quote
  #18  
Old 06-27-2012, 03:25 PM
fraby fraby is offline
 
Join Date: Oct 2011
Posts: 8
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Will this edit work on V4?
Reply With Quote
  #19  
Old 03-26-2013, 11:16 AM
fahad_althobian fahad_althobian is offline
 
Join Date: Apr 2010
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can it be done through the hooks?



So we make a product that do so, instead of manual modification!


I know how to program the hook amendment automatic template. But I do not know how to modify the code files.!
Reply With Quote
  #20  
Old 07-13-2013, 06:33 PM
tumboor tumboor is offline
 
Join Date: Aug 2009
Location: ksa
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks alot
Reply With Quote
  #21  
Old 09-30-2013, 04:57 PM
smirkley smirkley is offline
 
Join Date: Apr 2008
Posts: 627
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Going through the edits, I noticed several instances of $tachyjoin in my file. Which one is the right one?

(uninstalled as I cant properly complete the edits yet)
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 08:18 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.05035 seconds
  • Memory Usage 2,333KB
  • 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)bbcode_quote
  • (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
  • (11)post_thanks_box
  • (1)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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_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