1. 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?

Discussion in 'Styling and Customization Questions' started by DRE, May 28, 2012.

  1. DRE

    DRE Well-Known Member

    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');
        }
    }
     
  2. ragtek

    ragtek Guest

  3. DRE

    DRE Well-Known Member

  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    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.
     
    CritiKiL and 8thos like this.
  5. DRE

    DRE Well-Known Member

    Thanks! This works!
     
    CritiKiL likes this.
  6. LogOn

    LogOn Active Member

    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:

     
    Last edited: Jan 29, 2015
  7. Brogan

    Brogan XenForo Moderator Staff Member

    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.
     
  8. LogOn

    LogOn Active Member

    I'm sorry Brogan, but i dont' understand why i can do this thing with a free add-on like Extra Portal, but i can't do it with a add-on that cost me 40GBP.
     
  9. Brogan

    Brogan XenForo Moderator Staff Member

    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.
     

Share This Page