It looks like you're new here. If you want to get involved, click one of these buttons!
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
class GalleryImages_model extends Base_module_model {
public $required = array('title', 'path');
function __construct()
{
parent::__construct('gallery_images');
}
function list_items($limit = NULL, $offset = NULL, $col = 'id', $order = 'asc')
{
//$this->db->join('authors', 'authors.id = articles.author_id', 'left');
$this->db->select('id, title, path, published', FALSE);
$data = parent::list_items($limit, $offset, $col, $order);
return $data;
}
function form_fields($values = array())
{
$fields = parent::form_fields($values);
// ******************* ADD CUSOM FORM STUFF HERE *******************
$upload_path = assets_server_path('galleryImages/', 'images');
$fields['path'] = array('type' => 'file', 'upload_path' => $upload_path, 'overwriite' => TRUE);
$fields['published']['order'] = 1000;
//
return $fields;
}
}
class GalleryImage_model extends Base_module_record {
public function get_gallery_image()
{
return '<img src="'.img_path($this->path).'" />';
}
}
$config['modules']['gallery'] = array(
'module_name' => 'Gallery Images',
'instructions' => 'Here you can manage the gallery images',
'sanitize_images' => TRUE,
'model_name' => 'galleryImages_model'
);
CREATE TABLE `gallery_images` (
`id` int(11) NOT NULL DEFAULT '0',
`title` varchar(255) NOT NULL,
`path` varchar(255) NOT NULL,
`published` enum('yes','no') NOT NULL DEFAULT 'yes',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Comments
Also, when I click the edit link, it takes me to a page that has the main template with a 404 error. It should be taking me to an admin page similar to the create page.