Custom Module with Categories

edited August 2011 in Modules
Good day,

I am currently busy with a website that will contain products and services. I have created products and services the same way you have done in the tutorials (With modules). Was just wondering what would be the best way to implement categories per module?

Just another question regarding the blog. I see there is an upload form for uploading images. Have looked in the database, but can't really see where it is saving it, or is there an easier way to implement an image per post(Like WordPress - Post thumbnails)?

Thanks you.
Regards,
Dereck Bester

Comments

  • edited 8:03PM
    You could create a new module that contains all the categories and then associate them to appropriate services or products, by passing the $related variable to the parent::form_fields() as displayed below:
    function form_fields($values = array()) { // ******************* NEW RELATED CATEGORY FIELD BEGIN ******************* $related = array('categories' => 'categories_to_articles_model'); // ******************* NEW RELATED CATEGORY FIELD END ******************* $fields = parent::form_fields($values, $related); $CI =& get_instance(); $CI->load->model('authors_model'); $CI->load->model('categories_model'); $CI->load->model('categories_to_articles_model'); $author_options = $CI->authors_model->options_list('id', 'name', array('published' => 'yes')); $fields['author_id'] = array('type' => 'select', 'options' => $author_options); return $fields; }
    With regards to your second question, it by default gets saved to your assets/images/blog folder (assuming it is writable).
Sign In or Register to comment.