ElkArte Community

Extending Elk => Addons => Addons ideas and questions => Topic started by: niloc on July 06, 2016, 03:29:19 am

Title: SMF Portal / Home Page for forum
Post by: niloc on July 06, 2016, 03:29:19 am
Hi guys,

I kinda want to make a home page just like ElkArte's home page.. any suggestions on how I should go about it?

So far what I've found in this community is mainly a discussion on what to put in the front page of Elk Arte's site, but nothing much regarding how one can go about it.. :/

Mainly, I wanna know how to add a "Home" button / page and making that the default first page in index.php..

Title: Re: SMF Portal / Home Page for forum
Post by: emanuele on July 06, 2016, 05:41:38 am
Either SimplePortal http://addons.elkarte.net/feature/Simple-Portal.html (but I feel it's not working with 1.1), or you can have a look at the files we use here https://github.com/elkarte/elkarte.net/tree/master/elk (the name may be a little off (home/index.php).

Regarding the home button, I'm pretty sure I posted the addon used here somewhere, but I can't find it at the moment... :-\
/me 's search skills s**k
Title: Re: SMF Portal / Home Page for forum
Post by: niloc on July 08, 2016, 01:55:12 am
Okay I sort of "found" Frontpageinterface.php after reading up:
http://www.elkarte.net/community/index.php?topic=2859.0

It's a built-in function to enable any page to replace index.php if I am not mistaken..

But right now, there's just no visual admin interface to enable it right?

What's the manual way of doing it?



Also, I'm trying to figure this out to see if it works lol:
http://www.elkarte.net/community/index.php?topic=2846
Title: Re: SMF Portal / Home Page for forum
Post by: Jorin on July 08, 2016, 03:14:10 am
I am using this line of code in .htaccess:

Code: [Select]
DirectoryIndex start.php index.php

start.php is loaded instead of index.php. If start.php isn't found index.php is loaded instead.
Title: Re: SMF Portal / Home Page for forum
Post by: niloc on July 08, 2016, 03:42:24 am
Quote from: Jorin – I am using this line of code in .htaccess:

Code: [Select]
DirectoryIndex start.php index.php

start.php is loaded instead of index.php. If start.php isn't found index.php is loaded instead.

Hi Jorin, what is the code inside "start.php"?
Title: Re: SMF Portal / Home Page for forum
Post by: emanuele on July 08, 2016, 03:56:16 am
Quote from: niloc – Okay I sort of "found" Frontpageinterface.php after reading up:
http://www.elkarte.net/community/index.php?topic=2859.0

It's a built-in function to enable any page to replace index.php if I am not mistaken..

Yep, in 1.1 there is this interface as well, there is a bug though (i.e. no "forum" button when the front page is changed... sorry, I forgot to fix it in B1, will have to make it in B2).

To see how the front page interface works you can have a look at BoardIndex.controller, the whole thing is:
Code: [Select]
use ElkArte\sources\Frontpage_Interface;

if (!defined('ELK'))
die('No access...');

/**
 * BoardIndex_Controller class
 * Displays the main board index
 */
class BoardIndex_Controller extends Action_Controller implements Frontpage_Interface
{
/**
* {@inheritdoc }
*/
public static function frontPageHook(&$default_action)
{
$default_action = array(
'controller' => 'BoardIndex_Controller',
'function' => 'action_boardindex'
);
}

Write a class that extends Action_Controller and implements Frontpage_Interface, then you add a "public static function frontPageHook" that takes the default action and changes it to whatever your front page controller will be.

Quote from: niloc – But right now, there's just no visual admin interface to enable it right?
The admin interface is there, in the layout settings (it seemed the most logical to me, but maybe is not).
Title: Re: SMF Portal / Home Page for forum
Post by: ahrasis on July 08, 2016, 04:52:15 am
Any code that make your frontpage @niloc