Jump to:

10994 Posts in 2728 Topics by 1819 members

All other Modules

SilverStripe Forums » All other Modules » Newsletter Module: include subscription form

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 5737 Views
  • Nico
    Avatar
    Community Member
    7 Posts

    Newsletter Module: include subscription form Link to this post

    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

  • Nico
    Avatar
    Community Member
    7 Posts

    Re: Newsletter Module: include subscription form Link to this post

    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?

  • Nico
    Avatar
    Community Member
    7 Posts

    Re: Newsletter Module: include subscription form Link to this post

    seems i was a bit hasty, this does the trick

    function ShowForm(){
    $get = DataObject::get_one('SubscribeForm', "URLSegment = 'subscribe'");
    return new SubscribeForm_Controller($get);
    }

  • b0bro
    Avatar
    Community Member
    38 Posts

    Re: Newsletter Module: include subscription form Link to this post

    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?

  • Nico
    Avatar
    Community Member
    7 Posts

    Re: Newsletter Module: include subscription form Link to this post

    using a simple showform throws an error

    "Uncaught Exception: Object->__call(): the method 'fortemplate' does not exist on 'SubscribeForm_Controller'"

  • b0bro
    Avatar
    Community Member
    38 Posts

    Re: Newsletter Module: include subscription form Link to this post

    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!

  • Nico
    Avatar
    Community Member
    7 Posts

    Re: Newsletter Module: include subscription form Link to this post

    nice, that worked too, much cleaner, thanks for the tip

  • anothersuit
    Avatar
    Community Member
    1 Post

    Re: Newsletter Module: include subscription form Link to this post

    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.

    5737 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.