21294 Posts in 5734 Topics by 2602 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 576 Views |
-
MAYDAY!! Short Code problem heeeelllllllp

25 November 2011 at 8:34am Last edited: 25 November 2011 8:35am
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!
-
Re: MAYDAY!! Short Code problem heeeelllllllp

26 November 2011 at 6:55pm
A shortcode wouldn't work in a .ss template. If the function HTMLeMailForm is present in your Page file, it should get called with $HTMLeMailField.
-
Re: MAYDAY!! Short Code problem heeeelllllllp

28 November 2011 at 2:13pm
@Pix
How about trying this :static function EmailFormShortCodeHandler(){
$current = Controller::curr();
return $current->renderWith('SendForm');
}
| 576 Views | ||
|
Page:
1
|
Go to Top |



