MyBB Community Forums

Full Version: Internal Variables
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am currently developing a forum using Emerald template and am struggling to customize my website. I wish to use internal variables in one page in another one; i.e. I wish to display a list of all threads posted on the home display and thus wish to use the{$ThreadDisplay} code in the index template rather than the forum display template. However, even after I transfer the code to the template, the home page remains blank. Is there any way to control the path and location of internal variables to make them more customizable?
This is not as straightforward as you assume. The variable needs to be declared and populated before rendering the template by the PHP file. Not all variables are available in any template for that reason.

In your case index template is generated by running index.php. Forum Display gets generated by forumdisplay.php. The variable you are behind is loaded with data by the codes containing in forumdisplay.php only, How you can expect to have that variable in index without even calling forumdisplay?

You can, atmost create a custom page or core edit index.php repeating the code to generate data for assigning to variable from forumdisplay.php and then render the template to get it working, but thats a bad idea.
(2018-06-07, 10:17 AM)effone Wrote: [ -> ]This is not as straightforward as you assume. The variable needs to be declared and populated before rendering the template by the PHP file. Not all variables are available in any template for that reason.

In your case index template is generated by running index.php. Forum Display gets generated by forumdisplay.php. The variable you are behind is loaded with data by the codes containing in forumdisplay.php only, How you can expect to have that variable in index without even calling forumdisplay?

You can, atmost create a custom page or core edit index.php repeating the code to generate data for assigning to variable from forumdisplay.php and then render the template to get it working, but thats a bad idea.

I am not entirely competent in usage of php, so pardon my questions, but in order to core edit the index.php file to incorporate the threadlist onto the home page, what variables and code would I need to transfer from forumdisplay.php to index.php?