I've created a k2 template override for use on Contact pages. I've also made my Contact Form in ChronoForms 5.
I would like to have my k2 template automatically load and display my Contact Form from in page (.php), as opposed to having the enter the code snippet in the k2 item each time. Is this possible?
I would like to have my k2 template automatically load and display my Contact Form from in page (.php), as opposed to having the enter the code snippet in the k2 item each time. Is this possible?
Sloanthrasher,
I do have the K2 plug-in enabled and working, however this requires I manually enter the code snippet for my form to display each time. I am attempting to have the form display automatically from my template page 'item.php'. By loading the form in this manner I could then enter my code snippet once, and for each new contact item the form would just load.
I do have the K2 plug-in enabled and working, however this requires I manually enter the code snippet for my form to display each time. I am attempting to have the form display automatically from my template page 'item.php'. By loading the form in this manner I could then enter my code snippet once, and for each new contact item the form would just load.
Sloanthrasher,
I misread your post. Thanks for the suggestion. I will investigate the ChronoForms plug-in and see how it goes.
I misread your post. Thanks for the suggestion. I will investigate the ChronoForms plug-in and see how it goes.
Hi Wayne,
Using a module is the 'right' way to put content onto all/multiple pages of your site. Adding the plug-in link to the index.php file is unlikely to work.
Bob
Using a module is the 'right' way to put content onto all/multiple pages of your site. Adding the plug-in link to the index.php file is unlikely to work.
Bob
I had a look at the plugin however due to being loaded onContentPrepare that was not going to work as intended.
I was however able to use the module code to display my form in page just fine. Only thing I had to change was the $formname variable. I just hard coded the form name that I wanted loaded, instead of getting it from the params.
I was however able to use the module code to display my form in page just fine. Only thing I had to change was the $formname variable. I just hard coded the form name that I wanted loaded, instead of getting it from the params.
Here is the code used (chronoforms v5) taken from plugin. Please note that this code was inserted into item.php of my K2 template to be automatically included.
This must go at the top of page.
Directly after:
This code must go where you would like the form to appear.
Note that you must replace "YOURFORMNAME" with the case-senstive form name you wish to display. Fairly straight forward. I hope this helps.
This must go at the top of page.
defined("GCORE_SITE") or define("GCORE_SITE", "front");
jimport('cegcore.joomla_gcloader');
Directly after:
defined('_JEXEC') or die;
This code must go where you would like the form to appear.
<?php
if(!class_exists('JoomlaGCLoader')){
JError::raiseWarning(100, "Please download the CEGCore framework from www.chronoengine.com then install it using the 'Extensions Manager'");
return;
}
$chronoforms5_setup = function() use($params){
$mainframe = \JFactory::getApplication();
$formname = 'YOURFORMNAME';
$chronoform = GCore\Libs\Request::data('chronoform', '');
$event = GCore\Libs\Request::data('event', '');
if(!empty($event)){
if($formname != $chronoform){
$event = 'load';
}
}
return array('chronoform' => $formname, 'event' => $event);
};
$output = new JoomlaGCLoader('front', 'chronoforms5', 'chronoforms', $chronoforms5_setup, array('controller' => '', 'action' => ''));
?>
Note that you must replace "YOURFORMNAME" with the case-senstive form name you wish to display. Fairly straight forward. I hope this helps.
This topic is locked and no more replies can be posted.