• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

I making custom form template and i curious.

myfatebiz

Active Member
Hi,

Inside default.php why using echo $this->loadTemplate instead include?.

If using $this->loadTemplate, i can't pass variable into it but if using include i can pass it.

It's okay if i using include instead $this->loadTemplate?.

Thanks in advance.
 
What variable and from where are you trying to pass?

I using my own custom plugin which is it's load custom loader namespace from my folder. Under form template on default.php i load my class like below:

$Helper = new Forms\MyCustomClassFolder\Helper;

then i try to call $Helper variable inside default_group.php it's not gonna work because of this file called by using $this->loadTemplate('group') unless i change it into include 'default_group.php' then $Helper variable be able to use in there.

My question is here are there is bad practice to using include instead $this->loadTemplate()
 
OK, seems more clear now. I think this should be commented by someone more deeply familiar with Fabrik source code. But if it works as expected, I personally don't see any downsides of including your own helper file in template.
 
OK, seems more clear now. I think this should be commented by someone more deeply familiar with Fabrik source code. But if it works as expected, I personally don't see any downsides of including your own helper file in template.

It's working as expected. I'm just feel unease because need to change the way calling the file $this->loadTemplate('group') to include 'default_group.php'.

I have other option in my mind. I just do the class call for each file but the code seem look like unclean because same template need to call class for each file. :(
 
Yes!!!!!!. I finally found the solution. I just assign another $this value for my helper like below.

1. First at my default.php i need to call my class.

$Helper = new Forms\MyCustomClassFolder\Helper;

2. Assign that variable into $this.

$this->Helper = $Helper;

3. Then i can call that anywhere in the file.

echo $this->Helper->MyFunction;

Now i can use $this->loadTemplate('group').

I so happy now. ;)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top