PDA

View Full Version : description for meta and bookmarksite on showthread


Zachariah
18 Mar 2009, 01:22
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:
SELECT IF(visible = 2, 1, 0) AS isdeleted,

REPLACE WITH:
SELECT IF(thread.visible = 2, 1, 0) AS isdeleted,

ABOVE:
thread.*

Add:
" . iif($vbulletin->options['threadpreview'] > 0 AND THIS_SCRIPT == 'showthread', 'post.pagetext AS preview, ') . "

ABOVE:
$tachyjoin

Add:
" . iif($vbulletin->options['threadpreview'] > 0 AND THIS_SCRIPT == 'showthread', "LEFT JOIN " . TABLE_PREFIX . "post AS post ON(post.postid = thread.firstpostid)") . "

BELOW:
WHERE thread.threadid = $threadid
");

Add:
if($vbulletin->options['threadpreview'] > 0 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($threa dcache["$threadid"]['preview'], false, true), $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:
$bookmarksite['link'] = str_replace(
array('{URL}', '{TITLE}'),
array(urlencode($vbulletin->options['bburl'] . '/showthread.php?t=' . $thread['threadid']), urlencode($thread['title'])),
$bookmarksite['url']
);
Replace:
$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
http://digg.com/submit?phase=2&url={URL}&title={TITLE}&bodytext={DESCRIPTION}

viper357
09 Jul 2009, 21:57
Will this work on 3.6.12?

HMBeaty
09 Jul 2009, 22:20
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
05 Sep 2009, 04:09
WOW !!
this is what I am search ing about
I will try
if it work you should have the Nobel prize in coding

--------------- Added 1252121513 at 1252121513 ---------------

sorry it did not work
plz revise it
plz I need it so much

Lynne
06 Sep 2009, 20:00
Did you then add something to your meta tags in headinclude? Exactly what did you add there?

abdobasha2004
07 Sep 2009, 01:14
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
07 Sep 2009, 05:38
You need to use the variable $threadinfo, not $thread.

Zachariah
07 Sep 2009, 15:58
Fixed :)
- Thanks Lynne for the heads up on the typeo

abdobasha2004
07 Sep 2009, 16:46
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
19 Sep 2009, 04:38
Was having a little trouble until I noticed this post on another thread :up:

http://www.vbulletin.org/forum/showpost.php?p=1884101&postcount=10

KrisP
11 Oct 2009, 22:51
$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 1255300169 at 1255300169 ---------------

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
14 Oct 2009, 00:34
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
24 Oct 2009, 21:44
Something that would be very nice would be a "bloginfo[preview]" - a meta desription for blogs :)

KrisP
26 Feb 2010, 05:48
.......

sivaganeshk
12 Jan 2011, 16:27
should I make changes in vb 4.1.1 version or made it default ?

asd_ra7la
27 Sep 2011, 12:07
Thanks

fraby
27 Jun 2012, 17:25
Will this edit work on V4?

fahad_althobian
26 Mar 2013, 12:16
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
13 Jul 2013, 20:33
thanks alot

smirkley
30 Sep 2013, 18:57
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)