MyBB Community Forums

Full Version: What's it called when you use a var from a different template & how's it done?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm shocked I cannot find this answer myself (using a search phrase) so I think I'm using the wrong terminology here. Can anyone help?

First, what's the correct way to use a variable from another template? I'm trying to do something along the lines of using {$this_variable} in a template that it wasn't already designed to appear in. I suspect that if I paste something (maybe at the top) into the page, I can tell variables from *another* page to become available in the page I want to place {$this_variable}
How exactly do I accomplish this? What's the "trick" to making a template accept the variable from a different template?

Next, what's wrong with the terminology I'm using to ask this question? For me to search on Google and on this forum, only to not find my answer, tells me that my way of asking is incorrect. I must be asking for apples when in fact I should have said oranges. Kind of like a mixup when somebody is speaking in a language that isn't their first language. So... what's the correct terminology for my question? In other words... what sentence would have turned up the results in a google search? I know for a fact this question MUST have come up before today, but I'm just not sure how it was physically "asked" so I was unable to find it on my own. Should I be using a different word than "template" or a different word than "variable" when I talk about these items? Please help me understand.

Thanks!
Available variables depend on the context in which the template is evaluated, by the MyBB code.

So if a variable does not work, and no other variable with the desired contents is available, you would need a plugin or code change of some sort.
Can you give me an example of one?

Pick any variable you want, from any location you want, and tell me it.

Then, tell me what steps/coding rewrites you took to make it work in an alternate template?

I could have sworn there was something I saw somewhere that just lets you paste a line of code INTO the template you want the variable to work inside of, and it will call that version of said variable with the content it would have from its original template.

Also... is this really a rare question I am asking? I am guessing hundreds of people over time must have wanted to use a variable in a different template than the one that created it. I'm curious why I can't even find any specific results/examples via Google search? Am I asking the question wrong? I feel like I don't know the correct lingo here. lol

Anyone?