The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to change a variable value INSIDE of a template based on condition (test)?
Hello.
How to change the value of a php file var WITHIN a template? I'm still trying to understand this vB system. Example: For FAQ search, I want to change the default value of 'Matching Options' on-the-fly from 'ALL' to 'ANY' via the template and NOT by hacking faq.php. For example, I created this via the Plugin Manager in hook location, 'faq_start': PHP Code:
How can I call this code WITHIN the template? It would be ideal (at least until I understand the 'hook' system better) to call this via "($hook = vBulletinHook::fetch_hook('match_default')) ? eval($hook) : false;" directly inside of the template at the appropriate location OR some other way, which I have no idea... :ermm: Any suggestions on how to accomplish this end result? Thanks in advance. |
#2
|
|||
|
|||
Templates are HTML, not PHP. You can not run PHP inside templates.
|
#3
|
|||
|
|||
Thanks for your reply.
I know that you can't write PHP code inside of templates which is why I was trying to find another solution by creating the custom 'plugin'. I just didn't know how to get the vB software to recognize/execute it in the proper location. But, now I've since found out...whew. I FOUND IT! FINALLY......I think I know how the 'hook' system works! I had to read this thread again: https://vborg.vbsupport.ru/showthread.php?t=82625 and it finally 'clicked' on post# 28 ("...so the closest hook i could find is this...). I needed to add my custom code, NOT to faq_start hook, but to faq_complete since it was a hook that came AFTER the code I needed in faq.php!!!! So that's what a hook is!!! :lick: PHP Code:
Now, I'll be able to search php files for existing hooks and then create plugins to fit in the appropriate hook. If none exist in the right location, then I'll probably have to hack the file. I hope this process is correct for this is how I understand it now. Thanks to vb...org and its members for the help! |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|