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

wrong inherit

#1
Hello
from what class inherit a class
I inherit from a class forum
but comes Null

Code:
<?php
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
Code:
{xen:helper dump,$monster}
9991.jpg

and I receive Null
999.jpg


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

Thomas.B

Well-known member
#2
Code:
'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.
Code:
'monster' => 'I am a monster'
 
Last edited: