1. This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.
  2. In order to post messages and view attached files in this forum, you must be a licensed XenForo customer.
    If you can't post, enter your forum username in the Associated Forum Users form in your customer area.

How I created my external pages.

Discussion in 'Development Tutorials [Archive]' started by robdog, Mar 29, 2011.

  1. MaikKR New Member

    Hey Lu.
    Yes, I´ve checked it a few moments ago.
    There are all files in this structure.
    I don´t understand where the problem is,
    but we take a lot of energy to fix it wihtout sucess.
    There is no developer of the addon in this thread actually I think...

    Faithfully
  2. Lu Jia Active Member

    Try to post here En.php file, did you change something here?
  3. MaikKR New Member

    Hey Lu.
    No, I didn´t change anything in it.
    Here´s my file:

    Code:
    <?php
    
    class ExternalPages_Route_Prefix_En implements XenForo_Route_Interface
    {
        public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
        {
            $urlComponents = explode('/', $routePath);
            $subPrefix = strtolower(array_shift($urlComponents));
    
            switch($subPrefix)
            {
                case 'advertise':
                    $controllerName = 'ExternalPages_ControllerPublic_Advertise';
                    $routeName = 'en/advertise/';
                    break;
                case 'draft':
                    $controllerName = 'ExternalPages_ControllerPublic_Draft';
                    $routeName = 'en/draft/';
                    break;
                case 'privacy':
                    $controllerName = 'ExternalPages_ControllerPublic_Privacy';
                    $routeName = 'en/privacy/';
                    break;
                case 'schedule':
                    $controllerName = 'ExternalPages_ControllerPublic_Schedule';
                    $routeName = 'en/schedule/';
                    break;
                case 'tickets':
                    $controllerName = 'ExternalPages_ControllerPublic_Tickets';
                    $routeName = 'en/tickets/';
                    break;
                case 'tos':
                    $controllerName = 'ExternalPages_ControllerPublic_TOS';
                    $routeName = 'en/tos/';
                    break;
                default:
                    $controllerName = 'ExternalPages_ControllerPublic_Tickets';
                    $routeName = 'en/tickets/';
                    break;
            }
    
            return $router->getRouteMatch($controllerName, 'index', $routeName, $routePath);
        }
    }
    Faithfully
  4. Lu Jia Active Member

    This file is fine, maybe you can change it with a dynamic controllername is better if you don't want to add a new case every new pages.

    Btw, did you activate SEF? Try to enable it
  5. masterchief Active Member

    how to incorporate external pages into a php callback for custom page nodes???
  6. Lu Jia Active Member

    you don't need an external page to callback php in a custom page node because you can call it from the node's option.
  7. masterchief Active Member

    I want to utilize custom page nodes to do the same thing as my external pages, basically getting away from external pages.
  8. hathway Member

    I know this is an amateur question, however when trying to implement the add-on, I do not even see a development section in the ACP. I'm guessing it was under Development in the prior version of XF?? And then when I go to Home > Install Add-on, I need a XML file to upload, not the directories in post #1 in this thread. Any help would greatly be appreciated :)
  9. Daniel Hood Member

    You have to enable debug mode in order to see Development.
  10. hathway Member

    I could not find any documentation about enabling debug mode in the ACP or the help manual. I'll try to keep searching.
  11. Brogan Well-Known Member

  12. hathway Member

    I have implemented this add-on and got it working, made my new home tab, got it positioned in the home position (not the middle), however after reading through the thread multiple times, as well as numerous other threads, I still cannot understand two things.

    One I never found a clear concise way to remove the route prefix, and after creating my EP_Home template, it is still not showing up on the site? I do have Home.php under ControllerPublic and inside there I have replaced every instance of Tickets with Home, including where I call the EP_Home template.

    Any suggestions or help would greatly be appreciated :)
  13. hathway Member

    update: When I created the EP_Home template in the ACP I pasted in the template content info yet it would not show up on the home page. I exported the style to search through the XML doc and the template was not there. So I copied another template, replaced the content, changed the template addon_id to External_Pages (I added an underscore to my add on ID in the ACP) and then imported that style. It works this way, but I do not think that is the right way? Any insight?
  14. hathway Member

    I deleted that template I created in the XML file, re-created it a second time in the ACP and it seems to work now, interesting..?

    So now I'm just looking for the best way to remove the route prefix so my home page will be at root level:

    What I have:
    www.example.com/en/home

    What I want:
    www.example.com/home
  15. Epwna New Member

    I know this was quite some time ago but yes. I would love this solution :) I can't seem to find one that works.
  16. masterchief Active Member

    Check out post#55 .. you will be glad that you did.

Share This Page