Hello all,
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?
greets,
Nico
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Hello all,
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?
greets,
Nico
i managed to show the form on other pages by putting this in the pagecontroller
function ShowForm(){
$get = DataObject::get_one('UserDefinedForm', "URLSegment = 'subscribe'");
return new UserDefinedForm_Controller($get);
}
and this in page.ss
<% control ShowForm %>
$Form
<% end_control %>
However the available newsletter lists checkboxes are not included, does anyone have an idea what could be causing this?
seems i was a bit hasty, this does the trick
function ShowForm(){
$get = DataObject::get_one('SubscribeForm', "URLSegment = 'subscribe'");
return new SubscribeForm_Controller($get);
}
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?
using a simple showform throws an error
"Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'SubscribeForm_Controller'"
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!
nice, that worked too, much cleaner, thanks for the tip :)
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.