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

How To Change Default Page Route?

DRE

Well-known member
#1
The default route when creating a page is forums. How can I change it so that the default route is arcade? I want to create over a hundred pages embedded with flash games.

For example: http://www.8thos.com/pages/icy-fishes/

^^^I made icy fishes a route of games using an edit suggested by Jake Bunce

This is the edit:

/public_html/library/XenForo/Route/Prefix/Pages.php

Code:
<?php
 
/**
* Route prefix handler
*/
class XenForo_Route_Prefix_Pages implements XenForo_Route_Interface
{
    /**
    * Match a specific route for an already matched prefix.
    *
    * @see XenForo_Route_Interface::match()
    */
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
        $request->setParam('node_name', basename($routePath));
        if (in_array($request->getParam('node_name'), array('pixlr-editor', 'pixlr-express', 'pixlr-o-matic')))
        {
            $section = 'useralbums';
        }
        else if (in_array($request->getParam('node_name'), array('world-time-map', 'tinychat')))
        {
            $section = 'members';
        }
        else if (in_array($request->getParam('node_name'), array('kongregate', 'nuclear-outrun', 'icy-fishes')))
        {
            $section = 'arcade';
        }
        else
        {
            $section = 'forums';
        }
 
        return $router->getRouteMatch('XenForo_ControllerPublic_Page', 'index', $section);
    }
 
    /**
    * Method to build a link to the specified page/action with the provided
    * data and params.
    *
    * @see XenForo_Route_BuilderInterface
    */
    public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
    {
        return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'node_name');
    }
}
 

Jake Bunce

XenForo moderator
Staff member
#4
The default in that code is defined by:

Code:
        else
        {
            $section = 'forums';
        }
So if none of the other conditions match then it places all unmatched pages under 'forums'. You can change this if you want.
 

LogOn

Active member
#6
Hi guys i'v installed https://xenforo.com/community/resources/cta-featured-threads-portal.2599/ add on, and after install, my forum page was automaticaly changed from "http://page.com" to "http://page.com/forums"

My default page, "http://page.com" is now the portal page

I want the add on to work, but to keep the forum page as the defult page. To be more specifically, i want to change portal page into "http://page.com/portal" and the forum page into "http://page.com"

P.S.: i'v contacted the add-on suport, but they don't want to help me...

My Pages.php file is:

<?php

/**
* Route prefix handler
*/
class XenForo_Route_Prefix_Pages implements XenForo_Route_Interface
{
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$request->setParam('node_name', basename($routePath));

return $router->getRouteMatch('XenForo_ControllerPublic_Page', 'index', 'forums');
}

/**
* Method to build a link to the specified page/action with the provided
* data and params.
*
* @see XenForo_Route_BuilderInterface
*/
public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
{
return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'node_name');
}
}
 
Last edited:

Brogan

XenForo moderator
Staff member
#7
You don't have the Resource Manager installed.

Is this the same question you posted at my support site related to my add-on?

If so, the answer is the same.
You can't have the featured threads page set as the portal but the forum index as the landing page.

If it is set as the portal then it becomes the landing page.
Otherwise don't set it as the portal and it won't be the landing page.

I have already explained that.
 

Brogan

XenForo moderator
Staff member
#9
They are two entirely different add-ons, coded in completely different ways.
The fact that one is free and one is paid is irrelevant.

I think you need to look up the meaning of the word portal, in the context of a forum/site, to understand why it is set as the index/landing page.