Hi guys.
I’m a newbie in Yii.
I have gone through the docs and understand controller-model-view thing very well, but there’s one thing I’m missing.
What about reusable functionality?
For ex. there’s a blog application and BlogController has loadBlog function, that just loads currently viewed blog:
$this->_model = Blog::model()->findbyPk($id!==null ? $id : $_GET[‘id’]);
Now I have a widget which is supposed to display a list of ‘related’ blogs - it will extrat current blog tags and search for other blogs which have same tags.
So in my widget I will need that loadBlog function - should I copy/paste it or how do I make this functions reusable in multiple controllers?
Thank you.