Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » problem in function with $MenuTitle

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

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

Page: 1
Go to End
Author Topic: 1070 Views
  • ojalà
    Avatar
    Community Member
    87 Posts

    problem in function with $MenuTitle Link to this post

    HI!
    I waht to usea function in Page.php to print only 3 entry of $MenuTitle.
    So I use this code:

    function Ciclo_menu()
       {
          $array = $MenuTitle;
          for($i=0;$i<3;$i++)
          $nuovo_menu = $array[$i];
          return $nuovo_menu;

       }

    something is wrong, is it possible to use $menuTitle varable in Page.php function?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: problem in function with $MenuTitle Link to this post

    $MenuTitle would refer to the variable $MenuTitle in that function, you need to refer to the MenuTitle on the 'Object' rather then the function by doing

    $this->MenuTitle

    1070 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.