wrong inherit

Hugilore111

Member
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.webp

and I receive Null
999.webp


If you insert a different location, the property is shown
but I should like the picture
 
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:
Top Bottom