Insert basic page info instead of main content?

Neil E.

Active member
I'd like to add some really simple page information triggered by new buttons on the NavBar.
The buttons are easy thanks to Jake. http://xenforo.com/community/threads/how-to-add-a-new-tab-in-the-navbar.7781/

I want all the main content (including the top and bottom breadboxes) to be replaced with some sort of table (or object filled with text). The QuickSearch box would remain. Suggestions? I certainly don't want to tackle anything like Xenporta or Wordpress etc. I'm thinking along the lines of a new template that replaces the normal main content. Some form of hard coding would be OK.
 
OK, I looked at the other topic, but I don't get it.

Create new file on the server, no problem.
library/Callback/PageNode.php
<?php

class Callback_PageNode
{
public static function noContainer(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
{
$response->containerParams['containerTemplate'] = 'mycontainer';

$response->templateName = 'mycontent';
}
}


new template for 'mycontainer', should be possible
{xen:raw $contents}


new template for 'mycontent', should be possible
{xen:raw $templateHtml}


handle the callback, no clue here, looks like maybe I have to create a new page to have somewhere to put the callback, and the new page has to exist in the node tree (was looking for something simpler)
Callback_PageNode::noContainer


Any other methods? Leaving the breadcrumbs in place would be OK.
 
The callback is defined when adding or editing a page node in the Admin CP. You can hide the page from the node tree if you want. That's another option when adding / editing a page node.
 
I decided that including a file would do what I need. This keeps the page looking the same to users (main content becomes some html).

library/Callback/WelcomePage.php (new file)
<?php
class Callback_WelcomePage
{
public static function includeFile(XenForo_ControllerPublic_Abstract $controller, XenForo_ControllerResponse_Abstract &$response)
{
ob_start();
require('/welcomeXF.html');
$myContent = ob_get_contents();
ob_end_clean();

$params = array(
'myContent' => $myContent
);

$response->params = array_merge(
$response->params,
$params
);
}
}


Create New Page details
URL Portion: welcomeXF
Title: Welcome Page
Description: <div class="baseHtml messageText">
{xen:raw $myContent}
</div>
PHP Callback: Callback_WelcomePage::includeFile


Location of html file
www.odsc.on.ca/.xenforo/welcomeXF.html

Location of php file
www.odsc.on.ca/.xenforo/library/Callback/WelcomePage

Location of new page (will be the link in added extra NavBar Tab called "Welcome")
<a data-description="#nodeDescription-" href="index.php?pages/welcomeXF/">Welcome Page</a>

Error when I try to open the new page
Fatal error: Callback_WelcomePage::includeFile() [function.require]: Failed opening required '/welcomeXF.html' (include_path='/home/odsc/public_html/.xenforo/library:.:.:/usr/lib/php:/usr/local/lib/php') in /home/odsc/public_html/.xenforo/library/Callback/WelcomePage.php on line 7

Any idea what I'm doing wrong?
 
Well I was unable to find "phpinfo" in admin.php?tools/, but I did eventually get the server path correct. The callback is functioning as desired.

I would like to know how to get the name of the new page inserted into the breadcrumb.
 
Top Bottom