View Single Post
  #4  
Old 01-03-2013, 06:51 PM
kh99 kh99 is offline
 
Join Date: Aug 2009
Location: Maine
Posts: 13,185
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dog-tag View Post
I think then what I'm suppose to do is put my PHP into a hook...
Can a phrase call a hook? Or is a phrase just a phrase for looking at?
Phrases are pretty much just for looking at. The purpose really is to allow language changes by avoiding 'hard-coding' text anywhere.

A plugin is some php code that gets executed at a certain point in the vbulletin code, so that might be what you want. You can look at a vbulletin script and see where the plugins are executed. For example, if you look at showthread.php line 118 (in vb4.2.0 PL2), there's this:
Code:
($hook = vBulletinHook::fetch_hook('showthread_start')) ? eval($hook) : false;

That gets all the plugin code for hook location 'showthread_start' and executes it by calling eval. I think it can be confusing to newcomers (as it was to me) because it seems like there should be documentation of what you can do at different hook locations, but really they're just selected points in the vbulletin scripts, and what you can do at each one depends on how that script is written. So it's kind of like a puzzle sometimes to figure out how to get things done using just plugins. Of course there's no real reason you couldn't just modify the vbulletin files to do whatever you want, except that when you want to upgrade you'd have to edit the files again.



Quote:
If that isn't possible, then I need to put this hook into the correct template that is being called. In my case its the standard_error template (I'm pretty sure).

Problem is it will be used for all errors, so I'll need to learn then how to use an IF command after I see it working correctly!?

Do you think I'm on the right track? Thanks for replying to me, its hard to understand all this code at the start, vbulletin is a strange animal, (I tried liking your post Kevin but the forum won't let me.)

You might be able to use a plugin, but it depends on exactly what you're trying to do. Another possibility is to edit the template and use <vb:if>...<vb:else />..</vb:if> tags, but what you can do there is limited so a lot of times you also need a plugin to set up the variables you need. (Edit: here's the onlien manual: http://www.vbulletin.com/manual/ . If you haven't looked at it already, you might want to search for "template syntax" and "adding plugin" (select your vb version fromthe dropdown before searching).


I know it's confusing. It's hard to explain it in a short space (well, hard for me. Maybe someone else can do a better job).
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01101 seconds
  • Memory Usage 1,770KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete