I am trying to get a form embedded in my page through a short code. It was working just fine and showing up until I tried doing it with a template, and now NO form, but the the other stuff in the template shows up ("Form goes here" text)!
In Page.php:
public static function EmailFormShortCodeHandler($arguments, $content = null, $parser = null) {
$customise = array();
$customise['contactme'] = 'test';
$template = new SSViewer('SendForm');
return $template->process(new ArrayData($customise));
}
In SendForm.ss:
<% if SendSuccess %>
<h2>Your Email has been sent!</h2>
<% else %>
<h2>Form goes here</h2>
$HTMLeMailForm
<% end_if %>
The function to generate the form is in Page_Controller, when I called it directly from the short code it showed up, like this:
public static function EmailFormShortCodeHandler($arguments, $content = null, $parser = null) {
$current = Controller::curr();
return $current->HTMLeMailForm()->forTemplate();
}
But I really need to use a template to show the form, any suggestions please heeeeeeeeelllllllp!
Thanks!