Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » How to add a "Subscribe Form" into the another page

Our old forums are still available as a read-only archive.

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

Page: 1 2
Go to End
Author Topic: 6536 Views
  • roterl
    Avatar
    Community Member
    44 Posts

    How to add a "Subscribe Form" into the another page Link to this post

    Hi
    How can I add Newsletter subscribe form into another page ?
    I created a newsletter and "Subscribe Form" type page for it, and the subscription work fine. But I need it to be inside other page, and not as its own page.
    How can I do it?

    Thanks,
    Rotem.

  • roterl
    Avatar
    Community Member
    44 Posts

    Re: How to add a "Subscribe Form" into the another page Link to this post

    does any one have idea ??
    thanks.

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: How to add a "Subscribe Form" into the another page Link to this post

    You can do something like this in the template

    <% control Page(URL of Your Subscribe Page) %>
    $SubscribeForm - or whatever you have called it
    <% end_control %>

  • roterl
    Avatar
    Community Member
    44 Posts

    Re: How to add a "Subscribe Form" into the another page Link to this post

    I added:

    <% control Page(Subscribe) %>
    inside Subscribe Page
    $SubscribeForm
    <% end_control %>


    (also tried $Form instead of $SubscribeForm) but that does not work. (The "inside Subscribe Page" is displayed)

    any idea?
    thanks

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: How to add a "Subscribe Form" into the another page Link to this post

    try using a $Title or another field inside the control thats unique to that page to make sure its controlling the correct page. You could also try Page(Subscribe) with a lower case s. I think it uses the URL and that might be case sensitive.

  • roterl
    Avatar
    Community Member
    44 Posts

    Re: How to add a "Subscribe Form" into the another page Link to this post

    Adding other field work well.

    <% control Page(subscribe) %>
    inside Subscribe Page
          $Content
          $Form
    <% end_control %>


    I see the page content but not the form. (Also work with $Title)
    Also when I remove the $Form from the Page.ss file, the form indeed removed from the Subscribe page itself, so I guess this is the field I should use.
    Both uppercase and lowercase 's' do the same.

  • roterl
    Avatar
    Community Member
    44 Posts

    Re: How to add a "Subscribe Form" into the another page Link to this post

    any idea?
    $Content and $Title work well, but $Form dont

    thanks

  • Willr
    Avatar
    Forum Moderator
    5489 Posts

    Re: How to add a "Subscribe Form" into the another page Link to this post

    Ok a couple things you can do -

    * move the subscribe form code to Page.php so you can call the form from anywhere.

    * Or add a method to page.php which gets the form off the subscribe page

    // page.php (subscribe form is a 'SubscribeForm' method in a SubscribePage)

    function SubscribeBox() {
    return singleton("SubscribePage")->SubscribeForm();
    }

    6536 Views
Page: 1 2
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.