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

I can't get my alternative page container working

Discussion in 'XenForo Development Discussions' started by Umit, Mar 21, 2011.

  1. Umit

    Umit Active Member

    Lets make the thread hot again :p

    i couldnt apply this to my test page;

    Code:
    <?php
    
    class XenForo_testing_helloworld extends XenForo_ControllerPublic_Abstract
    {
        public static function actionIndex(XenForo_ControllerPublic_Abstract  $controller, XenForo_ControllerResponse_Abstract &$response)
        {
    
            $mytestContent = date("l, F d, Y h:i" ,time());
            $t = $controller->_input->filterSingle('t', XenForo_Input::STRING);
    
            $params = array(
                'mytestContent'  => $mytestContent,
                't' => $t
            );
    
              $response->params = array_merge(
                $response->params,
                $params
            );
    how can i do?
     
  2. Umit

    Umit Active Member

    still couldnt do it... any help?
     
  3. Kier

    Kier XenForo Developer Staff Member

    It's not clear what you want to do, could you clarify your question, and maybe post in the Development Questions forum, where people expect questions to be posted - this thread is unlikely to be visited by the people who might be able to answer your question.
     
  4. Umit

    Umit Active Member

    Basically, i created a plugin, as i posted above and i wanted to remove the xenforo container.
     
  5. Brogan

    Brogan XenForo Moderator Staff Member

    I've split your posts off and moved them to the development questions forum (as Kier suggested you do).
     
    Umit likes this.
  6. Arik

    Arik Well-Known Member

    Are you copying that code from somewhere? There are a few things wrong with it.

    1. Controller functions aren't static. Take that word out.
    2. Remove the parameters being passed to the actionIndex method.
    3. Instead of $controller->_input...do $this->_input (after all, you're in the controller class)
    4. Replace the entire $response->params part with a call to the responseView.

    PHP:
    return $this->responseView('ViewPublic_Class_Doesnt_Need_To_Exist',
    'template_name',
    $params,
    array(
    'container_template' => 'your_custom_container_template');
     
    Umit likes this.
  7. Umit

    Umit Active Member

    Hi, found it in the forum and i wanted to work on it.

    I've applied what you said and here is the error xenforo shows me:

    file structure: myXFinstall/Library/XenForo/testing/helloworld.php

    Code:
    <?php
    
    class XenForo_testing_helloworld extends XenForo_ControllerPublic_Abstract
    {
        public function actionIndex()
        {
    
            $mytestContent = date("l, F d, Y h:i" ,time());
            $t = $this->_input->filterSingle('t', XenForo_Input::STRING);
    
            $params = array(
                'mytestContent'  => $mytestContent,
                't' => $t
            );
    
            return $this->responseView('ViewPublic_Class_Doesnt_Need_To_Exist',
                'test-template',
                $params,
                array('container_template' => 'test_container')
            );
            }
    }
     
  8. Arik

    Arik Well-Known Member

    Attached Files:

  9. Umit

    Umit Active Member

    It is working! Thank you so much!..

    you can do a lot of things with this, ill try to do board stats..etc. I'll cache them and include into my website.
     

Share This Page