vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin Tips & Tricks (https://vborg.vbsupport.ru/forumdisplay.php?f=239)
-   -   description for meta and bookmarksite on showthread (https://vborg.vbsupport.ru/showthread.php?t=208657)

Zachariah 03-17-2009 10:00 PM

description for meta and bookmarksite on showthread
 
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}

viper357 07-09-2009 07:57 PM

Will this work on 3.6.12?

HMBeaty 07-09-2009 08:20 PM

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

abdobasha2004 09-05-2009 02:09 AM

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

Lynne 09-06-2009 06:00 PM

Did you then add something to your meta tags in headinclude? Exactly what did you add there?

abdobasha2004 09-06-2009 11:14 PM

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

Lynne 09-07-2009 03:38 AM

You need to use the variable $threadinfo, not $thread.

Zachariah 09-07-2009 01:58 PM

Fixed :)
- Thanks Lynne for the heads up on the typeo

abdobasha2004 09-07-2009 02:46 PM

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" :D:D

MagicThemeParks 09-19-2009 02:38 AM

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

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

KrisP 10-11-2009 08:51 PM

$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!!!!

Zachariah 10-13-2009 10:34 PM

Quote:

Originally Posted by KrisP (Post 1898277)
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.

KrisP 10-24-2009 07:44 PM

Something that would be very nice would be a "bloginfo[preview]" - a meta desription for blogs :)

KrisP 02-26-2010 03:48 AM

.......

sivaganeshk 01-12-2011 02:27 PM

should I make changes in vb 4.1.1 version or made it default ?

asd_ra7la 09-27-2011 10:07 AM

Thanks

fraby 06-27-2012 03:25 PM

Will this edit work on V4?

fahad_althobian 03-26-2013 11:16 AM

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.!

tumboor 07-13-2013 06:33 PM

thanks alot

smirkley 09-30-2013 04:57 PM

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)


All times are GMT. The time now is 01:56 AM.

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.01392 seconds
  • Memory Usage 1,785KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (10)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (20)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete