Skip to content

Instantly share code, notes, and snippets.

@overwine
Created May 25, 2012 15:15
Show Gist options
  • Save overwine/2788701 to your computer and use it in GitHub Desktop.
Save overwine/2788701 to your computer and use it in GitHub Desktop.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Admin extends Admin_Controller
{
public function index()
{
die(ENVIRONMENT);
//$this->load->model('Cats');
//$data['cats'] = $this->Cats->get_cats();
//$data['todo_list'] = array('Clean House','Call Mom','Run Errands');
//$data['title'] = "My Real Title";
//$data['heading'] = "My Real Heading";
//$this->load->view('blogview',$data);
$data['message'] = "Hello logged in admin guy!";
// Loads from addons/modules/blog/views/admin/view_name.php
$this->template->build('admin/blogview', $data);
}
}
<h3><?php echo $message;?></h3>
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class Cats extends Public_Controller
{
public function __construct()
{
parent::__construct();
}
public function index()
{
//$this->load->model('Cats');
//$data['cats'] = $this->Cats->get_cats();
$data['todo_list'] = array('Clean House','Call Mom','Run Errands');
$data['title'] = "My Real Title";
$data['heading'] = "My Real Heading";
$this->load->view('blogview',$data);
}
}
<?php defined('BASEPATH') or exit('No direct script access allowed');
class Module_Cats extends Module {
public $version = '1.2';
public function info()
{
return array(
'name' => array(
'en' => 'Cats Module 0.1',
),
'description' => array(
'en' => 'CATS! Yeah!',
),
'frontend' => TRUE,
'backend' => TRUE,
'menu' => 'content',
'shortcuts' => array(
array(
'name' => 'cats_mod.new',
'uri' => 'admin/cats_mod/create',
'class' => 'add'
),
),
);
}
public function install()
{
$this->dbforge->drop_table('cats');
$cats = "
CREATE TABLE ".$this->db->dbprefix('cats')." (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`weight` int(11) NOT NULL,
`color` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8
";
if($this->db->query($cats))
{
return TRUE;
}
}
public function uninstall()
{
if($this->dbforge->drop_table('cats'))
{
return TRUE;
}
}
public function upgrade($old_version)
{
// Your Upgrade Logic
return TRUE;
}
public function help()
{
// Return a string containing help info
// You could include a file and return it here.
return "<h4>WEWT! NO HELP FOR YOU!</h4>";
}
}
/* End of file details.php */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment