Mixing two modules Articles(new) and Pages
Hello,
as far as I'm a totally new user of FUEL, some issues are still a big challange for me. How do you think guys - is it possible to write a new module - Articles where I could add new publications with attachments, relate them with a page AND THAN mix it with Pages modul so I could make relation between article_id and page_id? In front-end the page would display (except of its own content) a list o related articles. I want to try this but let me know if it's possible. And second thing - can I set every new page will have a body_class = page_id? Thanks in advance!
Comments
http://docs.getfuelcms.com/general/layouts#layouts_custom_classes
function fields() { $fields = parent::fields(); // PUT YOUR FIELDS HERE... $fields['articles'] = array('type' => 'multi', 'model' => 'Articles_model'); return $fields; }
This would save the IDs of the related articles in for that page and then you could do something like the following in your layout and/or view file:
$articles = fuel_model('articles', 'within', array($articles)); foreach($articles as $article) : echo $article->title; endforeach;