I can't get my alternative page container working

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?
 

Umit

Active 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.
Basically, i created a plugin, as i posted above and i wanted to remove the xenforo container.
 

Brogan

XenForo moderator
Staff member
Basically, i created a plugin, as i posted above and i wanted to remove the xenforo container.
I've split your posts off and moved them to the development questions forum (as Kier suggested you do).
 

Arik

Well-known 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?
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

Active member
Are you copying that code from somewhere? There are a few things wrong with it.
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:

call_user_func_array() expects parameter 1 to be a valid callback, non-static method XenForo_testing_helloworld::actionIndex() should not be called statically

XenForo_Application::handlePhpError()
call_user_func_array() in XenForo/ControllerPublic/Page.php at line 46
XenForo_ControllerPublic_Page->actionIndex() in XenForo/FrontController.php at line 310
XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 132
XenForo_FrontController->run() in /Applications/MAMP/htdocs/xenforo/index.php at line 17
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')
        );
        }
}
 
Top