Route - actionIndex

Pierce

Well-known member
Code:
public function actionIndex()
    {
        // do stuff here to build $viewParams array and then...
     
        $viewParams = array();

        return $this->responseView(
            'MyAddOn_ViewPublic_Something_Index', // view name
            'onesignal_manifest', // content template name
            $viewParams, //  data to be passed to content template
            array('containerTemplate' =>
                'onesignal_manifest') // your own container template
        );
    }

Can somebody point me in the direction on where I should be reading for more information?

All I want to do is call a template called "onesignal_manifest" under containerTemplate.

Everything works but, working != right.

What is "MyAddOn_ViewPublic_Something_Index" ?
What is the content template name? is that the same as the containerTemplate?
 
here is an xample of the return line for you

Code:
return $this->responseView('XenForo_ViewPublic_Index', 'nudaii_xendit_index', $viewParams);

XenForo_ViewPublic_Index - this is the view 9 outta 10 times you can just leave it the default xenforo one.
nudaii_xendit_index - This is your template, which must be created in the master style (avaibl only when in development mode)
$viewParams - these are your template parimeters.


also the formatting looks like you are using the old hook system vs the new template modifcation system? is this your goal?
 
https://xenforo.com/community/threads/using-an-alternative-page-container.11465/


The code is lifted right off that page.

The goal here is to have a custom page example: https://letsgo.tools/os_manifest (it works) which requires absolutely no formatting as you can see apart from whats in it and it is apart of a bigger add-on that has grown significantly in 2-3 weeks. So my knowledge of how XF1.5 is being pushed to the limit.

The params are from the template system like $xenOptions->boardUrl/Title etc so I don't need to use $viewParams in this case and thus an empty array to satisfy the requirements.

I have at the moment a route

library/OneSignal/Route/Manifest.php

which calls

library/OneSignal/Controller/Manifest.php (I cant think of a better name to connect the two) which contains the code above, which calls a template...

Which is all originally called by creating a Route prefix in dev mode, and adding it to my add-on...
 
ah ok yes thats from 2011 the hook system has been largely depreciated since then and replaced bvy the template mod system, if your goal is to have a custom page it maybe easier for you to make it using a controller/route :)

example on my own site i made a custom page https://role-play-haven.com/Xendit using the above method.
 
ah ok yes thats from 2011 the hook system has been largely depreciated since then and replaced bvy the template mod system, if your goal is to have a custom page it maybe easier for you to make it using a controller/route :)

example on my own site i made a custom page https://role-play-haven.com/Xendit using the above method.

That is a nice looking mod.

I have been looking through other modifications and looking for suggestions on how I should approach this differently.

I cannot find any evidence of 2 types of addon's. Hooks (which I always thought of as template hooks for the template system) like this:

Code:
 public static function templateHook($hookName, &$contents, array $hookParams, XenForo_Template_Abstract $template)
        {

                        if($hookName === "page_container_head")
                        {
                                $contents .= $template->create('onesignal_js', $template->getParams());
                        }

        }

And a controller/route which is where you can code massive amounts of addon data. Which I though I was doing...

So I am missing some fundamental information about your response to allow me to understand better.
 
Back
Top Bottom