Skip to content

Instantly share code, notes, and snippets.

@og-shawn-crigger
Created July 27, 2012 18:21
Show Gist options
  • Select an option

  • Save og-shawn-crigger/3189560 to your computer and use it in GitHub Desktop.

Select an option

Save og-shawn-crigger/3189560 to your computer and use it in GitHub Desktop.
Create Help Controller in Bonfire

How to Create a Help Controller in Bonfire

This is just a simple gist showing how to create new Contexts inside the admin center of Bonfire, hopefully it will help someone out.

I found it quite useful when I wrote it

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
/**
* Bonfire
*
* An open source project to allow developers get a jump start their development of CodeIgniter applications
*
* @package Bonfire
* @author Bonfire Dev Team
* @copyright Copyright (c) 2011 - 2012, Bonfire Dev Team
* @license http://guides.cibonfire.com/license.html
* @link http://cibonfire.com
* @since Version 1.0
* @filesource
*/
// ------------------------------------------------------------------------
/**
* Help context controller
*
* The controller which displays the homepage of the Help context in Bonfire site.
*
* @package Bonfire
* @subpackage Controllers
* @category Controllers
* @author Bonfire Dev Team
* @link http://cibonfire.com/docs/guides/views.html
*
*/
class Help extends Admin_Controller
{
/**
* Controller constructor sets the Title and Permissions
*
*/
public function __construct()
{
parent::__construct();
Template::set('toolbar_title', 'Content');
Template::set_block('sidebar', 'articles/content/sidebar');
$this->auth->restrict('Site.Content.View');
}//end __construct()
//--------------------------------------------------------------------
/**
* Displays the initial page of the Content context
*
* @return void
*/
public function index()
{
Template::set_view('admin/help/index');
Template::set_block('sidebar', 'articles/content/sidebar');
Template::render('two_left');
}//end index()
//--------------------------------------------------------------------
}//end class
<?php
//@TODO: Find a better way to get the stupid display name!
if (isset($current_user))
{
//$display_name = (isset($current_user->display_name)) ? $current_user->display_name : $current_user->user_name;
$display_name = $current_user->email;
if ((isset($current_user->display_name)) && ! (empty($current_user->display_name)))
{
$display_name = $current_user->display_name;
}
if ((isset($current_user->username)) && ( ! empty($current_user->username)))
{
//$display_name = $current_user->display_name;
$display_name = $current_user->username;
}
}
?>
<h2>Welcome <?php echo ucwords($display_name); ?> you have logged in.</h2>
This should be your default help center, except I don't write in normal english but someelse can
this file is located at
app/views/admin/help/index.php
Goodbye!
@og-shawn-crigger

Copy link
Copy Markdown
Author

Sorry for the lack of a actual useful help page but I'm not a content editor, my help is look around and click shiz stupid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment