View Full Version : Create Template Group
RobDog888
10-15-2007, 02:00 AM
<font color="darkgreen">How the heck do you create a template group? I searched the API docs and the site but nothing comes up.</font>
Princeton
10-15-2007, 03:20 AM
in template_groups hook add..
$only['mytemplates'] = 'My Templates';
tips
* prepend all your template names with "mytemplates"
* save all templates in MASTER STYLE
RobDog888
10-15-2007, 03:29 AM
But thats just it. I found this
https://vborg.vbsupport.ru/showthread.php?t=70165
which showed me that file to use and there is a hook there at the bottom
($hook = vBulletinHook::fetch_hook('template_groups')) ? eval($hook) : false;
So I figured I could make a plugin for it and just merge a few array items to the $only variable but there is no listing in the add new plugin for template_groups.
Im sure there is a way but after that would having it as a plugin create an issue as its not really physically in the table?
Thanks
--------------- Added 1192423255 at 1192423255 ---------------
Hmm, how about like this having the plugin use global_start.
eval('$template_hook[template_groups] .= "' . array_push($only, 'item6' => $vbphrase['item6']) . '";');
Im really trying to avoid manual file and template edits for my product.
Andrew Green
10-15-2007, 03:47 AM
that article is a few years old, probably doesn't do it the same way.
You don't need any file edits, just name all your templates with the same prefix and create the plugin as Princeton said.
RobDog888
10-15-2007, 03:53 AM
<font color="darkgreen">Yes, I didnt even notice that. Guess too many hours on the computer today lol.
What would be the hook to use for this plugin? global_start? or cache_templates or parse_tempaltes etc?
I did name a few of my templates already like that and placed them in the User Control Panel Templates group with naming them usercp_blah but I now have to move them into this new group once the plugin is completed and I assume that will break some of my code in the php pages too. Oh well I guess I can fix it later. </font>
Andrew Green
10-15-2007, 03:56 AM
Yes, I didnt even notice that. Guess too many hours on the computer today lol.
What would be the hook to use for this plugin? global_start? or cache_templates or parse_tempaltes etc?
I did name a few of my templates already like that and placed them in the User Control Panel Templates group with naming them usercp_blah but I now have to move them into this new group once the plugin is completed and I assume that will break some of my code in the php pages too. Oh well I guess I can fix it later.
hook location is: "template_groups" under General Administration
RobDog888
10-15-2007, 04:02 AM
Son of a ... I have been looking throughout all the templates groups looking for it. Guess I passed through the admin stuff thinking it would be somewhere else.
Now I am not sure whats going on but it removed my vBAdvanced tempalte group and they are all at parent level with no new template group that I specified. Is my code ok?
Thanks :)
--------------- Added 1192425307 at 1192425307 ---------------
eval('$template_hook[template_groups] .= "' . array_push($only, 'testgroup' => 'Test Group') . '";');
That is the code I am using to test with. i didnt create a phrase for it yet so I just wrote it in there.
--------------- Added 1192429143 at 1192429143 ---------------
I checked out vBA's hook to see how they do it and theirs is like this...
$only['adv_portal'] = $vbphrase['group_adv_cmps'];
So I figured I could use the same code...
$only['test'] = 'Test';
But nada still. I even changed the execution order as they were both on 5. I changed mine to 6 and still nothing. I disabled vBA and yet still nothing. :(
--------------- Added 1192431724 at 1192431724 ---------------
I got it working with the code that was similar to vBA but the template group never showed up until I modified one template that was eventually going to go into it. Guess the template group will not show unless there is at lease one template in it.
Since thats the case, I wonder how you are supossed to do it without modifying the template record?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.