The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
VBulletin Programming 101?
Hello,
We've been using VB for the past 6 months, and although we are quite happy with the feature set, we find it very difficult to expand, because of the lack of documentation. I mean, is there anything beyond the 3 following links? http://www.vbulletin.com/forum/blogs/joe-d/3932614- http://www.vbulletin.com/docs/html/m...emplate_syntax http://www.vbulletin.com/forum/blogs...-luke/3929999- Doing reverse engineering, reading thousands lines of PHP code, performing tedious trial-and-error and pattern-matching programming, we were able to do a few things, though. For example, we developed a TeamSpeak plug-in that allows our users to create a TeamSpeak account from their VBulletin account and connect to TeamSpeak by a single click on our VBulletin site. So we know how to make a "product", create a template and insert it in hooks, code some PHP to support the product, make some SQL queries, etc. So we know how to do a few things, but this is far from being enough. For example, how do I know which variables I can use when coding (or modifying) a template? Where are these documented? Or which code can I read to find out? I have the feeling to be on a beach in a dark night with only a flash light in my hand. Very frustrating. Example: I'd like to add some buttons in the starter_threadview_text1 hook. The AdminCP hook dialog has a nice box in which I am told to enter the variables that I would like to pass to my template as parameters (like userinfo or page). Sounds cool, but which variables can I use for God's sake? How can my template get something as simple as the current page's url? Maybe I just completely missed some page or documentation from the start, and I will feel stupid when someone points me to it? Honestly I hope so, because at this point, I am just wasting my mental health double-guessing how the whole thing works and what I am allowed to do with it. Thanks in advance for any pointers, Yann Les Scorpions du D?sert |
#2
|
||||
|
||||
When I have used hooks, I have looked the hook location up in the templates (Search in Templates) to see what variables are available. For example, searching for "starter_threadview_text_1" gives me the display_contenttype_conversationstarter_threadview _Text template. It looks like the variable conversation is available there. Another thing I sometimes do is then search the files for that template to find out exactly what other variables may be available.
|
#3
|
|||
|
|||
Thanks for the fast response, I really appreciate it!
Yes, I can see the conversation={vb:raw conversation} in the template. This is the sort of guess work I've been doing. And this precisely illustrates my point: where is the conversation variable described? If it's an array or an object, what are its fields? In which PHP code are they initialized?... |
#4
|
||||
|
||||
That is when I go searching in the files for the template name to see where it is rendered. Then, you can see the variable registered for use in the template and see all the code above there that defines the variable. But, searching for the template names is sometimes a bit tricky in vB5 (I wish I could smack whoever thought it was a good idea to write the code this way!). If I search for "conversationstarter_threadview" I find that the template name actually comes up in the template "widget_conversationdisplay". So then I search on "conversationdisplay" and get nowhere. And I'm out of time to continue on this (gotta run!), but you can see that finding the right word to search on to find where it gets defined is just darned tricky (read as "is just a fr*gging nightmare!!!").
|
Благодарность от: | ||
tbworld |
#5
|
|||
|
|||
I know how you feel, that's exactly where I stand. It's like being in a rats maze. I hope when you come back you can give me some tips to understand how to follow the trail and dig out the info.
Again, with all my thanks for your help and your time! |
#6
|
||||
|
||||
Quote:
The variables are passed in from a number of different sources (sigh). The Frontend Controller (includes/vb5/frontend/controller ... since I can never find it), The API via direct call (vb/api), or a parent template i.e. widget/widget_activitystream: Code:
{vb:template {vb:raw activityStreamTemplateName}, conversation={vb:raw node.content}, reportActivity=1, showChannelInfo=1} |
#7
|
|||
|
|||
Interesting, you gave me some hints which helped me putting the first pieces of the puzzle together. Thanks to you, I found the vB5_Template::render() method in vb/includes/vb5/template.php and made some successful tests. I immediately documented what I found and understood, you can read it here:
https://docs.google.com/document/d/1...it?usp=sharing This will help me spread the knowledge to the other admins of our group. Again, I am not trying to find a fish to eat for one day, I am trying to learn fishing so I can feed myself for the rest of my life ;-) If this can be useful to other VB people at the same time, all the better. I look forward to your comments, Thanks to everyone for your help! Yann |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|