10851 Posts in 2517 Topics by 1793 members
|Go to End||Next >|
2 October 2009 at 11:01pm
I have created a subscription form to register on the newsletter lists. Is there a way to publish this form on other pages, for example in the sidebar?
3 October 2009 at 12:43am
i managed to show the form on other pages by putting this in the pagecontroller
$get = DataObject::get_one('UserDefinedForm', "URLSegment = 'subscribe'");
return new UserDefinedForm_Controller($get);
and this in page.ss
<% control ShowForm %>
<% end_control %>
However the available newsletter lists checkboxes are not included, does anyone have an idea what could be causing this?
3 October 2009 at 12:46am
seems i was a bit hasty, this does the trick
$get = DataObject::get_one('SubscribeForm', "URLSegment = 'subscribe'");
return new SubscribeForm_Controller($get);
3 October 2009 at 1:08am Last edited: 3 October 2009 1:09am
correct me if i'm wrong, but wouldnt a simple $ShowForm in the .ss template be sufficient? I cant see the need for the control?
3 October 2009 at 1:16am
using a simple showform throws an error
"Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'SubscribeForm_Controller'"
3 October 2009 at 10:28pm
Interesting, i should have tested it before opening my big mouth!
What about $Showform.Form ??
Ive done this on a site before, ill have to dig up the code when i get back to work. I know there isnt much point if your method works, but im just interested thats all!
4 October 2009 at 1:45am
nice, that worked too, much cleaner, thanks for the tip
27 December 2009 at 5:38am
I would like to include the newsletter subscription form to my Homepage. I have tried the previously mentioned ways but cant seem to get it to show. I noticed this in my Page.ss file - $Form -. I copied and pasted this to my HomePage.ss file and nothing.
I am not sure of the solution. I am new to Silverstripe. If anyone has any ideas that would be great thanks.
|Go to Top||Next >|