egghead Posted September 25, 2011 Share Posted September 25, 2011 hey just getting into yii and loving it but wanted to ask about all the widgets in the view, doesn't that sort of defeat the idea of views being clean? The widgets get passed encoded mysql within the view itself and that feels wrong. Isn't even this ultra-simple example too verbose for a view? but yii puts it right into the view. <? $this->widget('zii.widgets.CDetailView', array( 'data'=>$model, 'attributes'=>array( 'id', 'interview_id', 'interview_title', 'owner_id', 'duration', ), )); ?> Quote Link to comment https://forums.phpfreaks.com/topic/247815-yii-widgets-in-view/ Share on other sites More sharing options...
trq Posted September 25, 2011 Share Posted September 25, 2011 In this example, what exactly is $model? Quote Link to comment https://forums.phpfreaks.com/topic/247815-yii-widgets-in-view/#findComment-1272540 Share on other sites More sharing options...
egghead Posted September 25, 2011 Author Share Posted September 25, 2011 In this example, what exactly is $model? regardless, it's just a lot of junk for the view file, no?? I'm f'n confused i thought view was only supposed to be html with simple loops using data passed to it, now using YII my views are full of code. Quote Link to comment https://forums.phpfreaks.com/topic/247815-yii-widgets-in-view/#findComment-1272576 Share on other sites More sharing options...
trq Posted September 25, 2011 Share Posted September 25, 2011 You need to get your data into the view somehow. Generally, it's passed in through arrays, or turns up as properties of the view object itself. Unless $model actually represents an actual model, I don't see an issue here. Quote Link to comment https://forums.phpfreaks.com/topic/247815-yii-widgets-in-view/#findComment-1272706 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.