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


All times are GMT. The time now is 06:29 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.01393 seconds
  • Memory Usage 1,770KB
  • 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)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete