PDA

View Full Version : Calling new template / template variables


Replicant
05-11-2015, 01:29 PM
My most recent mod to my site is a split postbit. I saw it on ozzmods.com and just had to have it. I have it fully functional but I'm not fully satisfied with how I had to implement it. At first I had created a new template with all my code and called that template with {vb:template my_template} in the thread_header template. I had var dumps in the code and the variables werent being passed along to the new template. It wasn't working. I pasted all the code into the thread_header template and it worked perfectly. So, long story short,

Are the template variables local to each template?
Do I have to call the same {vb:data whatever ..... } code in each template?

delicjous
05-12-2015, 03:03 PM
Don't know for sure, but I think you have to.
Because you could call the same data a lot of times at one site but if you try to call it a second time in one template it doesnt work(ed for me last time I tried).

I was try to call a {vb:data user,...} a second time to make in one template to make two different <vb:each...>

Doesn't work... but I did not try to force it.

Dead Eddie
05-12-2015, 09:40 PM
You need to explicitly pass data from one template to another.

There should be plenty of examples in the code if you perform a search for vb:template to see the syntax. Don't have my vb5 install anymore to check.

Replicant
05-13-2015, 12:36 AM
Just so I'm sure I understand it and anyone else that reads this does too, in the example
{vb:template r-postbit, conversation={vb:raw conversation}}
I'm in the display_contenttype_threadview_header template. I'm calling my custom template r-postbit and the array conversation is passed along to that template? If that's correct, then I feel pretty dumb because I didn't put 2 and 2 together to figure that out.