page node

Senpai

Well-known member
hey xF members ,

you know when i create a page node does it create a templete and if it does please tell me where its located at and if theres no templete can you guys help me to create one
 
hey xF members ,

you know when i create a page node does it create a templete and if it does please tell me where its located at and if theres no templete can you guys help me to create one

When you create a new page node, a template is created named _page_node.x, where x is the node id. This template is used for HTML you may have placed in the Page Options->Template HTML text field.

If you want to display custom data from an add-on, then you need to have a class and method placed in the PHP callback fields that will be executed.

For example:
PHP:
class Icewind_IcewindDale_PageCallback_TrainingHall
{
    public static function trainingHall(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract $response)
    {   
        $visitor = XenForo_Visitor::getInstance()->toArray();
        if ($visitor['user_id'])
        {
           $charData = array('blah' => 'blah blah', 'bug' => 'bug bug');
           $response->params['char_data'] = $charData;
        }
        $response->templateName = 'icewinddale_training_hall';
    }
}

In this example the params is passed to the template named icewinddale_training_hall, that I created to be used.

If your page node is to be used to interact with members, then you need to create a ControllerPublic class to handle any form data, clicks, etc.
After the data is saved, it will return a response pointing back to the page nodes route, something like this:

return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
XenForo_Link::buildPublicLink('pages/training-hall'),
$charSavedResponse
);

or to another template:
return $this->responseView(
'IcewindDale_ViewPublic_Edit_User_Character',
'icewinddale_edit_user_character',
$viewParams
);
 
When you create a new page node, a template is created named _page_node.x, where x is the node id. This template is used for HTML you may have placed in the Page Options->Template HTML text field.

If you want to display custom data from an add-on, then you need to have a class and method placed in the PHP callback fields that will be executed.

For example:
PHP:
class Icewind_IcewindDale_PageCallback_TrainingHall
{
    public static function trainingHall(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract $response)
    {  
        $visitor = XenForo_Visitor::getInstance()->toArray();
        if ($visitor['user_id'])
        {
           $charData = array('blah' => 'blah blah', 'bug' => 'bug bug');
           $response->params['char_data'] = $charData;
        }
        $response->templateName = 'icewinddale_training_hall';
    }
}

In this example the params is passed to the template named icewinddale_training_hall, that I created to be used.

If your page node is to be used to interact with members, then you need to create a ControllerPublic class to handle any form data, clicks, etc.
After the data is saved, it will return a response pointing back to the page nodes route, something like this:

return $this->responseRedirect(
XenForo_ControllerResponse_Redirect::SUCCESS,
XenForo_Link::buildPublicLink('pages/training-hall'),
$charSavedResponse
);

or to another template:
return $this->responseView(
'IcewindDale_ViewPublic_Edit_User_Character',
'icewinddale_edit_user_character',
$viewParams
);
thank you soo much you know where do i place css
 
thank you soo much you know where do i place css

For Page Options->Template HTML? in with the html, like so:
<xen:require css="iwd_page_test.css" />
<div class="hello">hello page</div>

iwd_page_test.css template I created:
.hello
{
color: orange;
}

The above, for this example will generate hello page.

If you are using a PHP callback, just include it in your custom template at the top.
 
Top Bottom