![]() |
How do I assign a trigger(?) to a template?
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? |
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 PHP Code:
PHP Code:
|
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. |
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. |
This is the string to use to assign your term to a template:
PHP Code:
|
I just replace my_message with whatever I need, right?
Thanks a lot. |
bingo... :)
|
All times are GMT. The time now is 12:18 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|