Load form in php file

francescocartei 21 Jun, 2017
Hi,
This question is already present in other posts * **
However, they were about version 5, but I'm asking about version 6πŸ˜‰
On a php file located in the 'view' folder of a Joomla module, I have to insert a form built with chronoformsv6.
Reading the old posts, I found this php code:

JPluginHelper::importPlugin('content', 'chronoforms5');
$dispatcher =& JDispatcher::getInstance();
$form = $dispatcher->trigger('render_item', array('profile-information'))[0];
echo $form;


I believe that instead of 5 I have to put 6.
My question is: where do I have to insert the name of the form that I want to include?





* https://www.chronoengine.com/forums/posts/t99179/display-form-from-template-file.html?keywords=display%20form%20from%20template%20file
** https://www.chronoengine.com/forums/posts/t100292/load-form-in-php-file.html?keywords=display%20form%20from%20template%20file
Max_admin 21 Jun, 2017
Hi Armand,

I did not write this code but try to replace "profile-information" with the form alias in your v6 ?

The cleanest solution is to run Joomla content plugins on the module and use the Chronoforms6 plugin syntax, and have the plugin installed and enabled of course.

Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
francescocartei 22 Jun, 2017
Of course, but Chronoforms plugin does not work in php file😟 (view/default.php)
so I try this codeπŸ™‚
Max_admin 22 Jun, 2017
Hi Armand,

Please try this code then:

$mainframe = \JFactory::getApplication();

$contentParams = \JComponentHelper::getParams('com_content');
$dispatcher = \JDispatcher::getInstance();
$type = 'content';
\JPluginHelper::importPlugin($type);
$context = '';
$rowPlg = new \stdClass();
$rowPlg->text = '{chronoforms6}form-alias{/chronoforms6}';
$results = $mainframe->triggerEvent('onContentPrepare', array($context, &$rowPlg, &$contentParams, 0));
echo $rowPlg->text;


Best regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.