The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Adding very simple template hook
I am looking for some information regarding adding a very simple template hook. As basic as I can make it. Somewhere in the admin panel I would like to have one simple box that I can type text into and then in a template file place something like {vb:raw my_template} and have my single line of text appear. Is this possible. I can quite happily sit and edit files but looking for a starting point. A lot of the articles i have found are for previous versions of vBulletin or do not really touch on this at all
|
#2
|
|||
|
|||
First, put your site into debug mode. You should do this on a test site, but if you don't have one then the this article might be of interest: www.vbulletin.org/forum/showthread.php?t=265999 because you shouldn't really have your site in debug mode for everyone.
When you do that, then in the admincp, new links will appear. You can add a new settings group, or you can just add a setting to an existing group. You need to pick a unique value for vaname. That can't be changed, so if you need to change it later you need to delete your setting and add a new one. The rest of the settings can be edited as needed. Lets say you add a setting with 'my_text' as the varname (probably not a good choice in real life, but just as an example). Then whatever is entered there will be in $vbulletin->options['my_text']. [S]Unfortunately, that's not one of the variables that is automatically registered to a template[/S], Edit: actually I was wrong, I don't know why I believed that, but the options are registered automatically as vboptions. So you don't need a plugin, and I've changed the rest of this post to reflect that. Then in template template_name you can use either {vb:raw vbotions.my_text} or {vb:var vboptions.my_text} (using var will encode any special html chars like < and > so that they'll appear in the output, but doing that would make it impossible to include html in your field, so choose as appropriate). Also if you want, in an if condition you can use $my_text, like <vb:if condition="$vboptions[my_text] == 'something'">... |
#3
|
|||
|
|||
Works like a charm, To go one little step further. If i wanted to add my own tree navigation options like in the vb admin panel on the left hand side instead of adding it to the settings group would that be possible?
|
#4
|
|||
|
|||
Look in the includes/xml directory, at the files named 'cpnav_'. If you create your own file named cpnav_xxxx.php (replace xxxx with whatever you want), then you can add your own menu and/or choices to the admincp.
|
#5
|
|||
|
|||
Ah thank you, Why there isnt more information like this out there is beyond me I have done searches but find very little useful info.
|
#6
|
|||
|
|||
I have no idea what I was thinking, but of course the options *are* automatically registered to templates as 'vboptions', so you don't need a plugin to make this work. I've edited my post above to correct that.
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|