View Full Version : Call a template within a template
11 May 2009, 18:51
i would like to combine two mods. what's the easiest way to do this? i was thinking maybe i can call the one template from within the main mods template?
thanks for your help
11 May 2009, 19:05
What mods are you talking about?
And you cannot call a template from within another template, but you can grab a template from within a plugin and store the data into a variable that you can display in another template. But if you are talking about combining two mods I doubt it will be as simple as that.
11 May 2009, 19:08
thanks for your quick reply.
i would like Latest Album Pictures (http://www.vbulletin.org/forum/showthread.php?t=194827&page=6&highlight=album)
to display in All Albums (http://www.vbulletin.org/forum/showthread.php?t=172215)
11 May 2009, 19:13
You would have to modify the way both mods work in order to do it, if you are not a coder then you may find this difficult.
Basically you have to change the plugin that generates the latest albums and have it execute on the all albums page first. Then change it from making automatic template edits and have it store the data in a variable. And last you would have to modify a template from the all albums mod to add that variable in.
11 May 2009, 19:28
i was looking at the plugins but i didn't see an All Albums hook. i thought maybe i could make a new plugin based off of Latest Album and then make it use an All Albums hook or something.
idk, i might have to revisit this another time. i just don't have the time to research and make this happen right now i guess.
thanks again for your replies.
11 May 2009, 19:33
There isn't an 'all albums' hook... The best way would be to change the hook location to 'global_start' or one of the global hooks, check the THIS_SCRIPT define and only allow the rest of the code to execute when THIS_SCRIPT is defined as what it is defined as in the all albums file. You would also have to modifify the 'Latest Album Picture' plugin that executes on the hook location 'cache_templates' and change the THIS_SCRIPT check against that value as well instead of 'index' as it does now.
11 May 2009, 20:06
Here I just made some quick tests and here is a quick fix for the Album Pictures mod with changes to make it work on the all albums page...
You will need to edit the 'album_all_album_list' template and add '$pblatestalbums' to where you want the Album Pictures mod to display at. I have also attached a modified version of the 'all albums' product which has it showing right below the navbar if that is where you want it to display.
12 May 2009, 04:26
DUDE!!! THAT'S PERFECT!!!
you rock, bro! best thread and answer i've experienced in vbulletin :)
12 May 2009, 04:46
lol.. your welcome
vBulletin® v3.6.12, Copyright ©2000-2014, Jelsoft Enterprises Ltd.