vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Basic plugin help (https://vborg.vbsupport.ru/showthread.php?t=189656)

steven s 08-31-2008 05:34 PM

Basic plugin help
 
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
HTML Code:

<!-- 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

HTML Code:

// ### 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

HTML Code:

$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

steven s 08-31-2008 06:46 PM

Quote:

Originally Posted by Opserty (Post 1611352)
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

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?


All times are GMT. The time now is 01:09 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01147 seconds
  • Memory Usage 1,724KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_html_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete