Skip to main content
Topic: Start / community page (Read 15553 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Start / community page

It seems we at our car forum need a start page, just as you have it here. Is there an explanation anywhere how to create such a page? I didn't found any using the search form with "start page".

I think I will need some help creating and designing this page. Your help is much appreciated!  O:-)

Re: Start / community page

Reply #1
You can either create the page as you like it in HTML, then use Elk's SSI to bring in components like a login area and menu bars to recreate the look of the forum template pages. Or, you can create an addon which handles a front page from inside Elkarte. If you're going with the latter, take a look at SimplePortal and work from there :)

Re: Start / community page

Reply #2
Hm, sounds both absolutely impossible for me.  :D  :-[


Re: Start / community page

Reply #4
You can have a look at the one used on this very site at:
https://github.com/elkarte/elkarte.net/tree/master/elk
home.php is the php file that generates the page, then there is home.css with the styles. You can ignore tx_contrib.php it just provides the transifex contributors.
Bugs creator.
Features destroyer.
Template killer.

Re: Start / community page

Reply #5
With hook I know myself not like. Therefore, this approach.

Create the following files
root/sources/controllers/MyPage.controller.php
Code: [Select]
<?php

/**
 * Handles the moving of topics from board to board
 *
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This software is a derived product, based on:
 *
 * Simple Machines Forum (SMF)
 * copyright:    2011 Simple Machines (http://www.simplemachines.org)
 * license:        BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.0
 *
 */

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

class MyPage_Controller extends Action_Controller
{
    /**
     * Default action handler: just help.
     *
     * @see Action_Controller::action_index()
     */
    public function action_index()
    {
        $this->action_mypage();
    }

    /**
     * Prepares the help page.
     * Uses Help template and Manual language file.
     * It is accessed by ?action=help.
     */
    public function action_mypage()
    {
        global $txt, $context, $language, $scripturl;

        loadTemplate('MyPage');
        loadLanguage('Addons');

        // Build the link tree.
        $context['linktree'][] = array(
            'url' => $scripturl . '?action=mypage',
            'name' => $txt['mypage_page'],
        );

        // Lastly, set up some template stuff.
        $context['page_title'] = $txt['mypage_page'];
    }
}

root/themes/default/MyPage.template.php
Code: [Select]
<?php

/**
 * @name      ElkArte Forum
 * @copyright ElkArte Forum contributors
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause
 *
 * This software is a derived product, based on:
 *
 * Simple Machines Forum (SMF)
 * copyright:    2011 Simple Machines (http://www.simplemachines.org)
 * license:      BSD, See included LICENSE.TXT for terms and conditions.
 *
 * @version 1.0
 *
 */

function template_main()
{
    global $context, $txt;

// your content  
        echo '
            <div class="wrapper">
                <h2>', $txt['mypage_content'], '</h2>
            </div>';
}

open root/sources/SiteDispatcher.class.php
find
Code: [Select]
			'movetopic2' => array('MoveTopic.controller.php', 'MoveTopic_Controller', 'action_movetopic2'),
add after
Code: [Select]
			'mypage' => array('MyPage.controller.php', 'MyPage_Controller', 'action_mypage'),

open root/sources/Subs.php
find
Code: [Select]
			'register' => array(
'title' => $txt['register'],
'href' => $scripturl . '?action=register',
'data-icon' => '',
'show' => $user_info['is_guest'] && $context['can_register'],
),
add after
Code: [Select]
            
'mypage' => array(
'title' => $txt['mypage_page'],
'href' => $scripturl . '?action=mypage',
'data-icon' => '',
'show' => true,
),

open root/themes/default/language/english/Addons.english.php
add
Code: [Select]
//MyPage
$txt['mypage_page'] = 'My Page';
$txt['mypage_content'] = 'My content';

'data-icon' => '&#xf069;',  More icons => http://fortawesome.github.io/Font-Awesome/cheatsheet/

Regards Stephan

Re: Start / community page

Reply #6
You can have a look at the one used on this very site at:
https://github.com/elkarte/elkarte.net/tree/master/elk
home.php is the php file that generates the page, then there is home.css with the styles. You can ignore tx_contrib.php it just provides the transifex contributors.

Thank you.  :)

Re: Start / community page

Reply #7
I'm currently working on it. Can anyone help me what I have to to so the "Die Piloten" button in the menu (on the left) is in "clicked/active state" when I visit the start page home.php? Must I create an action for this site?

Re: Start / community page

Reply #8
Second question: How did you made the backgrounds? These rounded lines around the text? I tried to understand where these come from, but I can't find the classes in your css file.  :-\

Re: Start / community page

Reply #9
Since further .css classes are still imported.

home.php at line 14
Code: [Select]
$context['html_headers'] = '
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.css" />
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

The home.css causes only the button in the mobile view is hidden.  To create a button, clam up in my last post the instructions for Subs.php and the Info link for more icons. The data-icons are active in mobile view.





Regards Stephan

Re: Start / community page

Reply #10
I already have a button. I changed it's target to the start page (home.php), but it isn't active when I'm visiting the start page. A misunderstanding perhaps?

Re: Start / community page

Reply #11
If you have integrated the button as described above, this would have to be set as active.
Regards Stephan

Re: Start / community page

Reply #12
Have it tested me. It works.

My code of the button:
Code: [Select]
        'base' => array(
            'title' => $txt['home_btn'],
            'href' => $parsed['scheme'] . '://' . $parsed['host'] . (!empty($parsed['port']) ? ':' . $parsed['port'] : '') . '/elk105',
            'data-icon' => '',
            'show' => true,
            'action_hook' => true,
        ),

Is the solution von => http://support.elkarte-hilfe.de/index.php/topic,147.msg777.html#msg777

Regards Stephan

Re: Start / community page

Reply #13
Oops. Maybe I forgot anything. I will check the files later.  O:-)

Re: Start / community page

Reply #14
Second question: How did you made the backgrounds? These rounded lines around the text? I tried to understand where these come from, but I can't find the classes in your css file.  :-\

This with rounded corners is my goal.