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

Having issues editing response parameters in 1.2rc1...

Discussion in 'XenForo Development Discussions' started by Jaxel, Jul 17, 2013.

  1. Jaxel

    Jaxel Well-Known Member

    Okay, so lets say I have the following function:
    Code:
    <?php
    
    class EWRporta_ControllerPublic_Index extends XFCP_EWRporta_ControllerPublic_Index
    {
        public function actionIndex()
        {
            $response = parent::actionIndex();
       
                $response->params['layout1'] = 'index';
                $response->params['layout2'] = 'portal';
    
            return $response;
        }
    }
    Its simple, it adds two parameters to the parameters of the /index page. This worked perfectly fine in previous version of XenForo. However, now it does not. Those parameters are no longer set when I try to access them in my ViewPublic. How do I set these parameters now?
    Code:
    <?php
    
    class EWRporta_ViewPublic_Custom extends XFCP_EWRporta_ViewPublic_Custom
    {
        public function renderHtml()
        {
            if (empty($this->_params['layout1']))
            {
                echo "NO LAYOUT GIVEN"; exit;
            }
        }
    }
    In fact, if I add the following check to the ControllerPublic, it doesnt fire anymore:
    Code:
    if ($response instanceof XenForo_ControllerResponse_View)
    {
        echo "IS INSTANCEOF VIEW"; exit;
    }
     
    Last edited: Jul 17, 2013
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Did the Index controller not change in 1.2?

    Yup, it now reroutes to whatever you set in your ACP options for the Index controller (route). Will most likely need to do some extra work in your listener to extend the correct class.
     
    xf_phantom likes this.
  3. xf_phantom

    xf_phantom Well-Known Member

    I would suggest to check XenForo_ControllerPublic_Index ;)
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Yeah, it reroutes. Params won't work.
     
  5. Jaxel

    Jaxel Well-Known Member

    Thanks... figured it out...

    Index->Index is now Forum->Index
    and
    Forum->Index is now Forum->Forum
     
    Marcus likes this.

Share This Page