Log in

View Full Version : Basic plugin help


steven s
08-31-2008, 05:34 PM
I have several templates that require minor editing after reverting.
I figure it's time to learn how to use plugins to do my editing.

I've read a few tutorials and still not grasping it.

For my first plugin I simply want to add the background color black to my header template.

The reverted template looks like this
<!-- logo -->
<a name="top"></a>
<table border="0" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center">
<tr>
<td align="$stylevar[left]"><a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a></td>
<td align="$stylevar[right]" id="header_right_cell">
<if condition="$ad_location['ad_header_logo']">$ad_location[ad_header_logo]<else />&nbsp;</if>
</td>
</tr>
</table>
<!-- /logo -->

<!-- content table -->
$spacer_open

$_phpinclude_output

$ad_location[ad_header_end]

The bottom of the index.php file is

// ### ALL DONE! SPIT OUT THE HTML AND LET'S GET OUTTA HERE... ###
($hook = vBulletinHook::fetch_hook('forumhome_complete')) ? eval($hook) : false;

eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('FORUMHOME') . '");');


My plugin is
Product: vBulletin
Hook Location: forumhome_complete

$find = '<td align=\"$stylevar[left]\">';
$replace = ' bgcolor=\"black\"';
$vbulletin->templatecache['FORUMHOME'] = str_replace($find, $replace . $find, $vbulletin->templatecache['FORUMHOME']);
Can someone please point me in the right direction or shed some light?

Opserty
08-31-2008, 05:56 PM
Why don't you just edit the header template?

(Header templates are eval()'d before the forumhome is even started, they are eval()'d into $header variable in global.php).

May find this helpful: [How-To] Using Plugins for Automatic Template Edits (https://vborg.vbsupport.ru/showthread.php?t=151254&highlight=template)

steven s
08-31-2008, 06:46 PM
Why don't you just edit the header template?

(Header templates are eval()'d before the forumhome is even started, they are eval()'d into $header variable in global.php).

May find this helpful: [How-To] Using Plugins for Automatic Template Edits (https://vborg.vbsupport.ru/showthread.php?t=151254&highlight=template)
I have several other templates that need to be reverted and edited each time I upgrade.
I read the above url. I'll give it another read.

It sounds like I am using the wrong hook location then?