Log in

View Full Version : How to modify original vB templates via product?


XTF
04-19-2008, 08:19 PM
Hi,

I've got a 'product' that modified original vB templates. At the moment it just appears to overwrite them and when I uninstall my product, the original templates are gone too. So now, forumhome is missing for example.
This doesn't appear to be the right way. What is the right way?

Greetings

John3971
04-19-2008, 08:23 PM
This is totally wrong forum.

XTF
04-19-2008, 08:29 PM
This is totally wrong forum.

Yes, hehe, sorry, I noticed when it asked me all the extra details. Could a mod move it or do I have to repost it?

Mosh
04-20-2008, 07:00 AM
Hey Olaf,

Download a couple of my hacks and have a quick look at the some of the plugins. You should get the idea pretty quickly on how to do it.

But if you use vBulletin's template hooks, which are in most templates now adays, it would look something like this:
$template_hook['navbar_search_menu'] .= '<tr><td class="vbmenu_option"><a href="tags.php'.$session['sessionurl_q'].'" rel="nofollow">'.$vbphrase['bookmarksnavlink'].'</a></td></tr>';

If you are finding a location and pasting it exactly then it would be something like this:
$vbulletin->templatecache['FORUMDISPLAY'] = str_replace($vbulletin->options['sfutbf_ati_text'],$vbulletin->options['sfutbf_ati_text'].fetch_template('UnansweredThreadsByForum'),$vbull etin->templatecache['FORUMDISPLAY']);

Most hacks use either one or the other method for the most part for their hacks, so take a few to pieces and see how they flow. You will soon work out how to do it.

Mosh :)

Marco van Herwaarden
04-20-2008, 08:51 AM
If you have questions/problems with a modification or style, then please post in the thread (or support forum/board) about that modification/style. Best chance to receive a reply from either the author or another member using the same modification/style.

XTF
04-20-2008, 10:59 AM
If you have questions/problems with a modification or style, then please post in the thread (or support forum/board) about that modification/style. Best chance to receive a reply from either the author or another member using the same modification/style.

I'm the author of this product. ;)

Template hooks sound nice. When did they get introduced?

Marco van Herwaarden
04-20-2008, 11:05 AM
Template hooks where introduced in 3.6.

You should never modify a default vBulletin template and ship that modified template with a product. It will overwrite the template in teh master style and will not revert anymore to default vB when uninstalled.

XTF
04-21-2008, 11:56 AM
Template hooks where introduced in 3.6.

You should never modify a default vBulletin template and ship that modified template with a product. It will overwrite the template in teh master style and will not revert anymore to default vB when uninstalled.

I noticed. vB shouldn't allow this. ;)

However, the methods posted by Mosh aren't very flexible.

XTF
04-22-2008, 03:46 PM
Hey Olaf,

Download a couple of my hacks and have a quick look at the some of the plugins. You should get the idea pretty quickly on how to do it.

But if you use vBulletin's template hooks, which are in most templates now adays, it would look something like this:
$template_hook['navbar_search_menu'] .= '<tr><td class="vbmenu_option"><a href="tags.php'.$session['sessionurl_q'].'" rel="nofollow">'.$vbphrase['bookmarksnavlink'].'</a></td></tr>';

If you are finding a location and pasting it exactly then it would be something like this:
$vbulletin->templatecache['FORUMDISPLAY'] = str_replace($vbulletin->options['sfutbf_ati_text'],$vbulletin->options['sfutbf_ati_text'].fetch_template('UnansweredThreadsByForum'),$vbull etin->templatecache['FORUMDISPLAY']);

Most hacks use either one or the other method for the most part for their hacks, so take a few to pieces and see how they flow. You will soon work out how to do it.

Mosh :)
For example, I'd like to add a stats block to FORUMHOME. It should be at the end of this '<tbody id="collapseobj_forumhome_stats" style="$vbcollapse[collapseobj_forumhome_stats]">' tbody.
There's no hook, so only method 1 could be used.
However, method 1 isn't easy either in this case. Flexibility is also low.