3214 Posts in 848 Topics by 810 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1131 Views |
-
render function ?

15 June 2010 at 9:04pm Last edited: 15 June 2010 9:04pm
hi
i try to add newsletter form to my site
i've create new code/RegistrationForm.php like here http://doc.silverstripe.org/recipes:forms
also created RegistrationForm.ss in templates/includes only with this code
$Form
in layout puting <% include RegistrationForm %> but nothing, no form rendering
so how to render function from other classes which are not extends
example 1
class A extend B {
}class B extend Page_Controller {
function Form() {
};
}in A.ss $Form will be works
example 2
class A extends Page_Controller {
}class B extends Page_Controller {
function Form() {
};
}in A.ss $Form will not be works
-
Re: render function ?

17 June 2010 at 2:18pm
Well in example #2 - A does not extend B, A does not know about B. How is it meant to render if it has no idea of its existing. To get the function Form() you would have to create a new B (since you don't have a b)
class A extends Page_Controller {
function Form() {
$b = new B();return $b->Form();
}
| 1131 Views | ||
|
Page:
1
|
Go to Top |


