1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

wrong inherit

Discussion in 'XenForo Development Discussions' started by Hugilore111, Apr 13, 2016.

  1. Hugilore111

    Hugilore111 Member

    from what class inherit a class
    I inherit from a class forum
    but comes Null

    class  MyClass_ForumMyclass_ControllerPublic_MyIndex extends XFCP_MyClass_ForumMyclass_ControllerPublic_MyIndex
        public function actionIndex()
            $parent =parent::actionIndex();
                     ////my code
                     $viewParams = array(
                        'monster' => $monster,
                    $parent->params += $viewParams;
                  return $parent;

    Then insert into a template forum_list where I want to show off your property
    {xen:helper dump,$monster}

    and I receive Null

    If you insert a different location, the property is shown
    but I should like the picture
  2. Thomas.B

    Thomas.B Well-Known Member

    'monster' => $monster
    With this line you define a view paramater with the name „monster“ and the value $monster. However, as you did not assign any value to $monster, the dump shows just null. There should also be an error log entry „Undefined variable: monster“ for each load of the forum index. Btw, if you turn on the XF debug mode you will see the error message immediately instead of the forum index.

    So to test your modification you can change the line to e.g.
    'monster' => 'I am a monster'
    Last edited: Apr 14, 2016

Share This Page