ElkArte Community

Elk Development => Feature Discussion => Exterminated Features => Topic started by: emanuele on August 24, 2015, 05:34:11 pm

Title: Front page
Post by: emanuele on August 24, 2015, 05:34:11 pm
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
Title: Re: Front page
Post by: Joshua Dickerson on August 24, 2015, 08:53:12 pm
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
Title: Re: Front page
Post by: emanuele on August 25, 2015, 04:02:29 pm
Interesting idea. I'll give it a try!
Title: Re: Front page
Post by: emanuele on August 25, 2015, 04:26:04 pm
And here it is the result:
https://github.com/emanuele45/Dialogo/commit/aed01e2243f8762e24a5e6eb5f278f835bb52df0
Title: Re: Front page
Post by: Jorin on August 26, 2015, 01:40:25 am
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
Title: Re: Front page
Post by: wintstar on August 26, 2015, 02:15:47 am
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.



Title: Re: Front page
Post by: Flavio93Zena on August 26, 2015, 05:26:43 am
Someone messed up with closing stuff I guess ;D
Title: Re: Front page
Post by: wintstar on September 17, 2015, 03:50:40 am
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.
 
Title: Re: Front page
Post by: Ant59 on September 17, 2015, 04:38:28 am
Quote from: Jorin – 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

I wrote an addon that does this :) I'll have to upload it to Github when I get a chance.
Title: Re: Front page
Post by: shasha on September 17, 2015, 11:12:21 am
can't wait for this addon. Nice one guys.
Title: Re: Front page
Post by: emanuele on September 20, 2015, 11:27:43 am
Good point indeed...
Tracked: https://github.com/elkarte/Elkarte/issues/2237