• 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.

[Library] Set your own Route/Controller as Homepage

Could this be used for loading a custom php file as the home page?

Cheers

I'm sure you can looking at the functionality altho you'd have to set the correct values for routePrefix and controllerClass which I guess is the big question that someone with the knowledge would have to give you

But if you are using a completely custom php file why dont you try just naming it index.php and renaming the current index to index1 or the likes and use it in the root? and then have it link to the forum etc from there? You can link the forums homepage tab to you custom php file from there?

I was using a custom html file for some tests in a similar manner it did work altho I didn't extensively test it to actually check whether what was in the original php file was essential strictly within an index to have everything work properly.

On that note if it does break something and you are the trial and error kind of guy like I am then you could just try shoving the custom php above the existing index file php itself while having a backup of course ;) (probably goes against normal developer operation but lol hey whatever works right? lol)
 
But if you are using a completely custom php file why dont you try just naming it index.php and renaming the current index to index1 or the likes and use it in the root? and then have it link to the forum etc from there? You can link the forums homepage tab to you custom php file from there?
Sadly close to everything uses the default xenforo index so I couldn't do this :)

Thanks for the info and I'll give it a try anyway :)
 
Sadly close to everything uses the default xenforo index so I couldn't do this :)

Thanks for the info and I'll give it a try anyway :)

Oh right It did seem to have an odd structure vs the VB index. Im still a week into xenforo altho that is no excuse and I shall keep my mouth shut in the future unless im doubly sure. My bad :/

Strange tho I manage to call the login drop down via my custom index.html file when I tested I just didn't use it or go further because I found this mod and I figured 'd just use a page for my splash front. Maybe because it was an html? and the index.php was still intact?

And lol if you do try shoving it into the existing php and it does work let me know. I'd try it out but I havent installed a test board yet and swamped with work :/

Brogan had used a htaccess redirect and suggested I do the same when I was snooping around to have my own custom page.
 
Oh right It did seem to have an odd structure vs the VB index. Im still a week into xenforo altho that is no excuse and I shall keep my mouth shut in the future unless im doubly sure. My bad :/
haha nah its fine :)
Strange tho I manage to call the login drop down via my custom index.html file when I tested I just didn't use it or go further because I found this mod and I figured 'd just use a page for my splash front. Maybe because it was an html? and the index.php was still intact?
well am only quoting my time when I tryed to use wordpress index in the same dir as xenforo and it was 110% fail (for me anyway)
And lol if you do try shoving it into the existing php and it does work let me know. I'd try it out but I havent installed a test board yet and swamped with work :/

Brogan had used a htaccess redirect and suggested I do the same when I was snooping around to have my own custom page.
Yea thinking more into this I might just use a custom template and dumb all my html in it that would work as the only php I have in the file is "pulling" all the xenforo js, css and loginbar/userbar (like my booru does)

More playing is needed :P
Cheers
 
I'm having trouble with this mod...

Code:
<?php

class EWRporta_Listener_Init
{
    public static function listen(XenForo_Dependencies_Abstract $dependencies, array $data)
    {
        if (!$dependencies instanceof XenForo_Dependencies_Public)
        {
            return;
        }

        if (XenForo_Application::get('options')->EWRporta_index)
        {
            $config = new Zend_Config(array(
                'routePrefix'    => 'portal',
                'controllerClass' => 'EWRporta_ControllerPublic_Portal',
                'majorSection'    => 'portal',
                'minorSection'    => 'layout_id'
            ));

            EWRporta_Helper_Index::setDefaultRoute($config, $data);
        }
    }
}
Code:
<?php

class EWRporta_Route_Portal implements XenForo_Route_Interface
{
    public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
    {
        $action = $router->resolveActionWithStringParam($routePath, $request, 'layout_id');
        return $router->getRouteMatch('EWRporta_ControllerPublic_Portal', $action, 'portal');
    }

    public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
    {
        return XenForo_Link::buildBasicLinkWithStringParam($outputPrefix, $action, $extension, $data, 'layout_id');
    }
}

With these settings... if I go to: http://8wayrun.com/ it should resolve to http://8wayrun.com/portal/ ... which it does.

In my portal index I have the following:
Code:
$this->canonicalizeRequestUrl(XenForo_Link::buildPublicLink('portal', array('layout_id' => $layoutId)));

Which gives me problems if I go to http://8wayrun.com/portal/alt/ ... the canonicalization doesn't read the minorSection for some reason.
 
Quick Comparison of route prefixes, used for matching:

Stock XenForo:
  • homepage: /index/ (points to the forum home)
  • individual forums: /forums/
  • individual threads: /threads/
  • individual pages: /pages/
Shifting forum home to its separate route-prefix:
  • homepage: /index/ (points to your own controller)
  • forum home: /forum/
  • individual forums: /forums/
  • individual threads: /threads/
  • individual pages: /pages/
Jaxel is right in that it's more work for me to reuse the /forums/ route prefix, because it already is used for displaying individual forums and sub-forums. So shifting the forum home to a separate route prefix (/forum/) is easier.

Why cant the individual forums be set like stock as /forums/ Jaxel as set his addon as well to /forum/ how would I change it back to the stock setup as /forums/ please, I looked on xenforo and on here and cant see no setting on xenforo anywhere?

Like this I'm wanting it.

I'm wanting the URLs like this:
  • homepage: / (points to your own controller)
  • forum home: /forums/
  • individual forums: /forums/1/
  • individual threads: /threads/1/
  • individual pages: /pages/1/
 
I followed your tutorial and in details:

1. I've created the library/CustomIndex directory after uploaded your plugin in library folder
2. I've created and edited the file Addon.php with this content:

PHP:
public static function initDependencies(XenForo_Dependencies_Abstract $dependencies, array $data)
{
    if (!$dependencies instanceof XenForo_Dependencies_Public)
    {
        return;
    }
 
    $config = new Zend_Config(array(
        'routePrefix'    => 'recent-activity',
        'controllerClass' => 'XenForo_ControllerPublic_RecentActivity',
    ));
 
    GeekPoint_CustomIndex_Helper::setDefaultRoute($config, $data);
}

3. I've created the listener as in following pict:

Schermata 01-2455931 alle 22.32.34.webp


but still no luck. The system return:

Code:
public static function initDependencies(XenForo_Dependencies_Abstract $dependencies, array $data) { if (!$dependencies instanceof XenForo_Dependencies_Public) { return; } $config = new Zend_Config(array( 'routePrefix' => 'recent-activity', 'controllerClass' => 'XenForo_ControllerPublic_RecentActivity', )); GeekPoint_CustomIndex_Helper::setDefaultRoute($config, $data); }

What's wrong? :(
 
Back
Top Bottom