vBulletin

Thank you for visiting. This is our website archive. Please visit our main website by clicking the banner above.
vBulletin FAQ is dedicated to helping the forum owner build, manage and profit from his vBulletin Forum
vBulletin Web Hosting - Free skins and styles for your vBulletin - Search Engine Optimization




[Quick Hint] Making use of vBPhrases

theMusicMan
10-26-2005, 09:43 AM
Here's one that you might find interesting. vBulletin phrases are a fantastic way of managing all manner of things on your forum - their uses are almost endless.

Tutorial level: Intermediate

Have you ever wanted to use the vB New Posts search, but not to return threads and posts from certain forums? You may have a few news forums that you want to create a New Posts search from. Well, you may already know that there is no 'include' command, but there is an 'exclude' command and this is achieved by using;search.php?do=getnew&exclude=x,y,z
where x,y,z are the forumID's of those categories you do not wish to return posts from. Now, this is fine unless you; 1 - offer several templates to your users in which case you need to amend the search links across many templates
2 - you are regularly adding forum categories that you also wish to exclude from new posts listings- again which means you will need to amend several templates to include the new forumID's
Well, if you use a vBPhrase that contains the numbers of the forumID's you wish to exclude, once the templates have been updated to contain this Global phrase, you will only need to amend the vBphrase to update this excluded forum list from you new post searches.

Here's how.

1. There are a few things you first need to determine; 1 - the forumID's of those you wish to exclude (in our example we will use the invented forumID's 5,7 and 16)
2 - where you want to include the link to your new posts excluding certain forums search. (In our example, we will add this to the default vB3.0.n navigation bar).
The standard navbar code that uses the New Posts search is;<td class="vbmenu_control"><a href="$vboptions[bburl]/search.php?$session[sessionurl]do=getnew" accesskey="2">$vbphrase[new_posts_nav]</a></td> We need to add the forumID's we wish to exclude from the New Post search onto the end of the getnew part of this line, thus for our example the line will look like (note the added red code);<td class="vbmenu_control"><a href="$vboptions[bburl]/search.php?$session[sessionurl]do=getnew&exclude=5,7,16" accesskey="2">$vbphrase[new_posts_nav]</a></td>
However, we want to be able to make use of vBPhrases to achieve the same thing. To do this we need to create a new phrase called say – excluded_forumid_from_getnew

Go to AdminCP > Languages and Phrases > Phrase Manager > Add new phrase

Phrase Type = leave as GLOBAL
Varname = excluded_forumid_from_getnew
Text = 5,7,16

Then click save.

We now need to substitute the 5,7,16 in our example above, with the name of our newly created phrase. We do this by using the vB command;$vbphrase[name_of_phrase]
So, we now need to amend the line above to the following (note red code); <td class="vbmenu_control"><a href="$vboptions/search.php?$session[sessionurl]do=getnew&exclude=$vbphrase[excluded_forumid_from_getnew ]" accesskey="2">$vbphrase[new_posts_nav]</a></td>
Now, to add this to our forum navbar, we need to add the line above to the [b]navbar template

Find<td class="vbmenu_control"><a href="$vboptions[bburl]/calendar.php?$session[sessionurl]">$vbphrase[calendar]</a></td>
Add after <td class="vbmenu_control"><a href="$vboptions[bburl]/search.php?$session[sessionurl]do=getnew&exclude=$vbphrase[excluded_forumid_from_getnew ]" accesskey="2">$vbphrase[new_posts_nav]</a></td>Now each time you add a new forum to the list of those you do not wish to have new posts returned from, simply edit the vbphrase excluded_forumid_from_getnew and that’s it!!

Yes, this is perhaps a tutorial not suited for beginners, but if you want to do this feel free to ask away in here and I am sure someone will help you.

Joeychgo
10-26-2005, 09:38 PM
Thanks for the write up John!


vBulletin

seo book

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum