While writing the home page addon for
@Jorin I started wondering: why not use the hook to switch the home page at will?
So I decided to give it a try and put some code together, and I ended up with an hopefully easy admin and code interface to allow any controller become the front page.
If you don't know what a "Controller" is, think about it as "action=something".
So the attachments are a quick example of a couple of controllers I wrote as a demo: there is the board index (that is also the default, so it's a bit redundant) and there is the "message index" (described as "the content of a board") that allows to use a board as front page.
And the relevant code is:
https://github.com/elkarte/Elkarte/compare/elkarte:development...emanuele45:front_page?expand=1
what do you think? 1.1? O:-)
If not 1.1 then I'll put it together as an addon of course, though it will not be as effective, because I'll have to find some kind of "hack" to override the existing controllers, but I guess I'll be able to find something. :P
I like it. One suggested change: create an interface Frontpage (or something) then you can make canFrontPage() return in_array('FrontPage', class_implements($this)); This way you are checking more than if the class says it can, you are checking if it has the required method(s) as well.
Or, you can just do that in getFrontPageControllers().
http://php.net/manual/en/function.class-implements.php
Interesting idea. I'll give it a try!
And here it is the result:
https://github.com/emanuele45/Dialogo/commit/aed01e2243f8762e24a5e6eb5f278f835bb52df0
And now combine this with the opportunity to create pages within ElkArte with your own HTML code and choose them in your list too, and you have a small portal solution out of the box. :D
There is a bug in the current version. The text "Select the board to show on the front page:" overwrites the text "Members per page in member list" in the Standard drop selection.
Someone messed up with closing stuff I guess ;D
Have tested the new feature. In my opinion it would be better for the selected board to create a Home button. Because when you choose a board as a home, you have no look at any other boards. Or is it a bug.
Even if it was a bug, I would find it better to create a separate menu button for a selected board.
I wrote an addon that does this :) I'll have to upload it to Github when I get a chance.
can't wait for this addon. Nice one guys.
Good point indeed...
Tracked: https://github.com/elkarte/Elkarte/issues/2237