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

Addon as default page?

Discussion in 'XenForo Pre-Sales Questions' started by airworks, Nov 28, 2010.

  1. airworks

    airworks Member

    I'm wondering if it's possible to set an addon as the default page instead of the forum? For example, in IPB you can change the default application by editing the value of a constant. If you set that value to say 'portal' your main page would now show the portal instead of having it at /portal. The forum index could then be located at /forums, /index, or another subdirectory. Is it possible to do that in XenForo?
     
  2. Decent60

    Decent60 Well-Known Member

    Sure it is!

    There is a section in the Basic Board Information Options that allows you to set your forum's URL (e.g: http://www.yoursite.com/forum) and your site's home page (e.g http://www.yoursite.com/ or whatever you want). This will set your Home tab to whatever your homepage is set to. Mine is currently set to just my forum's home page.
     
  3. airworks

    airworks Member

    Not sure if you misunderstood, but I wasn't really asking about the home tab.

    What I meant was for example say you have your forum in the root at:
    "myforum.com"
    And you have an addon at:
    "myforum.com/myaddon"

    Is it possible to have "myforum.com" show the contents of "myforum.com/myaddon" (let's say the addon is a portal and thus the portal is now shown at "myforum.com" instead of the forum index), and now the forum might be accessed from "myforum.com/forums" instead.

    Hopefully that is more descriptive.
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    First you would install xenForo in the web root of your site (yoursite.com).

    Then setup friendly URLs like what you see here on xenforo.com. Friendly URLs are a built-in feature of xenForo. This creates the appearance of subdirectories using xenForo's own URL paths. For example, this non-friendly URL:

    http://xenforo.com/community/index.php?threads/addon-as-default-page.8510/

    ...becomes this:

    http://xenforo.com/community/threads/addon-as-default-page.8510/

    Addons usually have their own URL paths within xenForo.

    Then you need to change the URL paths to your liking. I am a little fuzzy on this part, but I think you can do this with custom rewrite rules or a xenForo addon. This gets into custom code. You can always post a request in this forum. I am sure you will find some one to help.
     
  5. Decent60

    Decent60 Well-Known Member

    Sorry, you're correct I misunderstood you.

    Currently, there isn't a default way to do that with the XenForo setup. However I do believe that the Portal Addon/Mod does do something similar to this. I don't use Portal pages so I am not sure.
     
  6. Forsaken

    Forsaken Well-Known Member

    Kovifor was able to do this, and I think he is intending to write a guide at some point to share it with the community (Not sure).

    This was a few weeks ago, so I could be wrong.
     
  7. Jeremy

    Jeremy XenForo Moderator Staff Member

    This was actually a few days ago. but the basic steps I used to accomplish this, was to define a new route prefix (I used forum-index) in the Development section and set the route class to be one of my own making. And since I couldn't figure out a way to accomplish it... I copied & pasted the contents of the XneForo_RoutePrefix_Index::actionIndex() class to a new actionIndex() function in my route prefix. I could probably write up a new method to get it set up. But this method provides a few errors I haven't sat down to figure out yet.
     
    Digital Doctor likes this.
  8. airworks

    airworks Member

    Does this indicate that you had to alter the core forum code, or is this still all code within your own addon?

    Well I guess in any case that answers my question, that I'd need some custom solution in order to do this. :(
     
  9. Jeremy

    Jeremy XenForo Moderator Staff Member

    I did an add-on, but I copied core code.
     
  10. Jeremy

    Jeremy XenForo Moderator Staff Member

    But I am looking for a way to not copy code.
     
  11. airworks

    airworks Member

    Okay, thanks for the info.
     
  12. Digital Doctor

    Digital Doctor Well-Known Member

    Many many people look forward to this breakthrough.
    Is there a way to explain what you did, including what code to copy, that could help others ?
     
  13. Jeremy

    Jeremy XenForo Moderator Staff Member

    I'll poke around the code to see if I can figure some things out (and release it as an add-on).
     
  14. Digital Doctor

    Digital Doctor Well-Known Member

    Great news.
    Here's a free digital Tee Shirt.
    xenforo.Tshirt.jpg
     
    Jeremy likes this.
  15. Jeremy

    Jeremy XenForo Moderator Staff Member

    And... once I do some code clean up and make it its own add-on... See picture. I just tested it and...

    Screen shot 2010-12-19 at 7.02.55 PM.png
     
  16. Digital Doctor

    Digital Doctor Well-Known Member

    I'm not sure what you have planned.

    But I think people mostly want is for whichever Addon (which usually has it's own Tab) to be displayed when a user goes to www.site.com. People don't want the Forum tab highlighted ....
    FYI, I do know there is a MOD which allows you to Highlight a certain tab when a certain page is displayed.
     
  17. Jeremy

    Jeremy XenForo Moderator Staff Member

    I'm not sure if I could modify the tab. I'll see what I can get done and all, but mostly, this works. I need to figure out how to get this to work if invalid input is placed in there.
     
  18. Digital Doctor

    Digital Doctor Well-Known Member

  19. Jeremy

    Jeremy XenForo Moderator Staff Member

  20. Digital Doctor

    Digital Doctor Well-Known Member

    Any progress King K ?
     

Share This Page