Jump to:

3392 Posts in 976 Topics by 852 members

Template Questions

SilverStripe Forums » Template Questions » very simple question about control

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

Page: 1
Go to End
Author Topic: 589 Views
  • cobianzo
    Avatar
    Community Member
    8 Posts

    very simple question about control Link to this post

    Hi , there is something I can not understand at all... and it's very simple.

    I have a

    NewsHolder extends Page


    and

    NewItem extends Page


    then in

    NewItem_Controller extends Page_Controller
    ...
    function my_NewItem_function ()
    {
    return "this is a test";
    }

    so in NewsHolder.ss

    <% control AllChildren %>
    <h1> $title </h1>
    <p> $my_NewItem_function </p>
    <% end_control %>

    Very simple, right?
    It just doesnt work. Inside the control it just doesnt recognize the method of NewItem. I dont understand it.
    If , in the control, i use something like $Top.my_NewsHolder_function --> It works !

    I looked for a threath that talks about it but i didnt find it... i thanks any help...

  • cobianzo
    Avatar
    Community Member
    8 Posts

    Re: very simple question about control Link to this post

    I got it...

    the function

    function my_NewItem_function ()
    {
    return "this is a test";
    }

    should be defined in the model ,, not in the Controller...

    cheers

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