View Full Version : How do I assign a trigger(?) to a template?
Lanigironu
03-08-2002, 04:32 AM
I created a template that mentions all the super mods and admins of the board. We used to have it in the header, but with more styles, differing from each other, it gets a bit complicated to update it if needed.
So what I want is to assign a trigger like $modslist or something, so I can put that in each header and have it called from the template that way.
How would I do that?
slideboxer
03-08-2002, 06:12 AM
Whenever I want to add something like this I usually do it in my global.php.
I have a button appear on the top of my header for my moderators to link to the moderator cp. In my global.php I entered this code
if (($bbuserinfo[usergroupid]==6 or $bbuserinfo[usergroupid]==5 or $bbuserinfo[usergroupid]==7)) {
$modbutton="<a href=\"http://www.abudokan.com/mod_directory/index.php\"><img src=\"http://www.abudokan.com/images/top_mod.gif\" border=\"0\" alt=\"Moderator Panel\"></a>";
} else {
$modbutton='';
} above $header='';
I hope I read your question right and was able to answer for you.
Lanigironu
03-09-2002, 04:17 AM
This isn't quite what I need though.
Basically I want to be able to put "$modslist" in a template, and it would show whatever "$modslist" is assigned as. I want "$modslist" to actually show the template called "modslist".
Is this clear enough? I really don't know how to explain this better.
bigmattyh
03-09-2002, 06:53 PM
It really depends on where you're going to use it. If you're sure you'll be using it on several pages, then you may want to edit global.php and define $modslist there. On the other hand, if you know you're probably only going to use it on the main page, or the forumdisplaypage, you'd want to define $modslist there. The idea is that you don't want to clutter global.php with a bunch of extra code, if you really don't need it there.
So step 1: where are you doing to use it?
As for defining the variable (step 2), this takes a little experience with MySQL and the vB functions and database class. You just need to create a query that returns the moderators for the given forum and pass those values into $modslist.
As for the specific code, hopefully someone will be able to help you, if you need it.
slideboxer
03-09-2002, 07:27 PM
This is the string to use to assign your term to a template:
eval("\$my_message .= \"".gettemplate("my_message")."\";");
Lanigironu
03-09-2002, 10:06 PM
I just replace my_message with whatever I need, right?
Thanks a lot.
slideboxer
03-10-2002, 02:00 AM
bingo... :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.