Log in

View Full Version : How to use "$thread[preview]" in meta description


abdobasha2004
09-05-2009, 02:06 AM
The $thread[preview] value gives the first few words of a thread
it is already defined in vbulletin script and foumd in threadbit template, when mouse passed over the thread title it gives thread description as first fee words
however if I use it in meta description it shows nothing

why?
Is there any necessary tags or definition or any thing??!

bmckinley
09-05-2009, 02:25 AM
Not sure, but it would seem necessary to make it an <a>ttribute. The meta needs to know that is code, not just funny type...try using the <a href="......."></a> and see if anything changes. You also need to tell it which thread to pull from.

abdobasha2004
09-05-2009, 02:38 AM
You also need to tell it which thread to pull from
i think that is the problem
how is that

bmckinley
09-05-2009, 02:42 AM
Not sure how to code that part. Suggest you copy the code from a template that it is working in,,,and then make the adjustments as needed. That should give you the right format.

abdobasha2004
09-05-2009, 02:52 AM
this can not happen
I can not use the template in meta description !
I think this needs php designer or something !

Lynne
09-05-2009, 04:41 AM
The header template is evaled before the thread preview is defined which is why you don't have that variable available to you right there. You will need a plugin to do this. Someone just posted this exact same question a couple days ago and we went over what to do. Try a a search for it.

abdobasha2004
09-05-2009, 05:06 AM
The header template is evaled before the thread preview is defined which is why you don't have that variable available to you right there. You will need a plugin to do this. Someone just posted this exact same question a couple days ago and we went over what to do. Try a a search for it.
oh plz
did you find any plugin
plz give me the link
plz

thanks

Lynne
09-06-2009, 04:35 PM
There is even an article on this and it was written after 3.8 came out so I'm sure it is up-to-date if you follow the instructions exactly - https://vborg.vbsupport.ru/showthread.php?t=208657&highlight=meta*

abdobasha2004
09-06-2009, 09:29 PM
There is even an article on this and it was written after 3.8 came out so I'm sure it is up-to-date if you follow the instructions exactly - https://vborg.vbsupport.ru/showt...ighlight=meta*
I tried
it DID NOT work
the coder also says :The code needs some optimization, but you will get the idea.

993ti
09-13-2009, 01:54 PM
It does work mate ;)
Follow the instructions and when you are going to edit the template(s), use $threadinfo[preview] instead of $threadinfo['preview'] (note the difference).
I'm using it in the headinclude template like this:
<meta name="description" content="<if condition="$pagenumber>1"><phrase 1="$pagenumber">$vbphrase[page_x]</phrase>-</if>$threadinfo[prefix_plain_html] $threadinfo[preview] $foruminfo[title_clean]" />

Check the source here to see it working ;) http://www.streetcars.nl/showthread.php?t=271

MagicThemeParks
09-19-2009, 01:35 AM
993ti, any particular place that I should put it in the headinclude for it to show correctly?

Edited: Got it, nevermind :)