Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

Archive /

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

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

How to add a "Subscribe Form" into the another page


Go to End


14 Posts   7287 Views

Avatar
roterl

Community Member, 44 Posts

10 June 2008 at 11:06pm

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.

Avatar
roterl

Community Member, 44 Posts

16 June 2008 at 5:33pm

does any one have idea ??
thanks.

Avatar
Willr

Forum Moderator, 5523 Posts

16 June 2008 at 6:00pm

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 %>

Avatar
roterl

Community Member, 44 Posts

17 June 2008 at 7:21pm

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

Avatar
Willr

Forum Moderator, 5523 Posts

17 June 2008 at 7:36pm

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.

Avatar
roterl

Community Member, 44 Posts

17 June 2008 at 7:44pm

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.

Avatar
roterl

Community Member, 44 Posts

19 June 2008 at 6:20am

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

thanks

Avatar
Willr

Forum Moderator, 5523 Posts

19 June 2008 at 9:22am

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();
}

Go to Top