Frontainer

Erstellt am: Tuesday 31 January 2017  |  Letzte Änderung am: Saturday 11 August 2018

This article is a part of the Working with ItemManager series.

What is Frontainer

Frontainer is a frontend user management plugin, based on ItemManager for GetSimple-CMS, especially useful for plugins developers. Frontainer provide a good basis for the further development of user management based tools or e-commerce plugins, for instance.

Frontainer Features

  • Frontend login form
  • Registration and the lost password form
  • Fully customizable HTML, CSS
  • Fully scalable and extendable functionality
  • Multilingual (currently English language file included)

Requirements

To run Frontainer on your GetSimple website just needs a number of things:

  • ItemManager plugin must be installed and configured.
  • User category must have already been created in ItemManager.
  • Pages with these slugs should be created: login, signup, accounts, logout, recovery, activate.

Installation

Download http://get-simple.info/extend/plugin/frontainer/1015/ and extract it.

Upload it to your GetSimple plugins directory.

You can activate the plugin in the plugins menu.

Optionally, you can also configure your plugin under the plugin settings menu.

Prepare your theme for using Frontainer. Open template.php file with your editor and add the following lines to the very beginning (first line):

<?php
if(!defined('IN_GS')) die();
if(!isset($_SESSION)){session_start();}
$fnavi = array(
    'login' => null,
    'signup' => null,
    'accounts' => null,
    'logout' => null,
    'recovery' => null
);
$fcontent = '';
if(function_exists('frontainer_get_content')) {
    $fcontent = frontainer_get_content();
    $fnavi['login'] = htmlspecialchars(get_section_url(LOGIN_SLUG));
    $fnavi['signup'] = htmlspecialchars(get_section_url(SIGNUP_SLUG));
    $fnavi['accounts'] = htmlspecialchars(get_section_url(ACCOUNTS_SLUG));
    $fnavi['logout'] = htmlspecialchars(get_section_url(LOGOUT_SLUG));
    $fnavi['recovery'] = htmlspecialchars(get_section_url(RECOVERY_SLUG));
}

After that you'll need to add a single line anywhere within the body of your template.php file for the output of Frontier's contents:

<?php echo $fcontent; ?>

Optionally, to access or switch between Frontainer's pages you can use following navigation structure, for example:

<ul class="nav navbar-nav">
    <li><a href="<?php get_site_url(); ?>forum/">Forum</a></li>
    <?php
    if(!isset($_SESSION['loggedin'])) {
        echo '<li ';
        if($id == $fnavi['login'] || $id == $fnavi['recovery'])
            echo 'class="active"';
        echo ' ><a href="'.$fnavi['login'].'">Login</a></li>';
        echo '<li ';
        if($id == $fnavi['signup'])
            echo 'class="active"';
        echo ' ><a href="'.$fnavi['signup'].'">Sign up</a></li>';
    } else {
        echo '<li ';
        if($id == $fnavi['accounts'])
            echo 'class="active"';
        echo ' ><a href="'.$fnavi['accounts'].'">Private</a></li>';
        echo '<li ';
        if($id == $fnavi['logout'])
            echo 'class="active"';
        echo ' ><a href="'.$fnavi['logout'].'">Logout</a></li>';
    }
    ?>
</ul>

Autor: Bigin  |  Tags:  FrameworkPHPGetSimpleDevelopmentItemManager