yiic shell webapp menu

Suggestion

I think it would be a good idea if the crud generated by yiic created the menus within a widget. I am talking about the menus generated in the views, eg "Create Post" "Modify Post". Right now it simply has a list of links like so:

. I think it would be better if it did something like this:


<?php

$this->widget('Menu',array('items'=>array(

	'Post List',array('list'),

	'Post Admin',array('admin'),

)));

?>

and implant the menu widget similar as in my skeleton application:

http://code.google.com/p/yii-skeleton-app/source/browse/trunk/protected/components/widgets/Menu.php

I have already attained this by extending yiic and it works great. New it’s easy to change the style of all the menus at once.

I recommend the menu looks like this instead by default:

Weel, menus in views are generated by crud command, not webapp command. So, extend the crud command to include the widget is what you need, I guess.

Yeah, that’s exactly what I did

I’m saying perhaps it should do this by default

On the other hand, that would assume everyone starts their application with the webapp command and thus has the menu widget

I am not sure whether or not we should go much further in making the code generated by crud more powerful. While some users may want the default generate code to be quite usable already, some other users may not like this because it could be less intuitive or take more time to adapt it to fit for special needs.

In general, I think it is more useful to let people know how to customize the model/crud templates rather than writing complicated yet powerful default templates.

Below is part of the "view.php" file that is generated by my customized crud template:




<?php

$this->pageTitle=t('View News');

$this->crumbs=array(

    t('News')=>array('news/list'),

    $model->title,

);

$this->operations=array(

    t('List News')=>array('news/list'),

    t('Create News')=>array('news/insert'),

    t('Related Contents')=>array('news/links','id'=>$model->id),

    t('Update This News')=>array('news/update','id'=>$model->id),

    CHtml::linkButton(t('Delete This News'),array(

            'submit'=>array('news/delete','id'=>$model->id),

            'confirm'=>t('Are you sure to delete this news?'),

)));

?>


<h1><?php echo t('View News'); ?></h1>



The corresponding part of the screenshot is attached to this post. As you can see, in this view template, we don’t use menu widget at all, but we are still able to generate the needed menu items.

qiang, looks like in symfony :)

I suppose I agree

but, maybe in the "official extension repository" your thinking about creating there could be some more advanced yiic commands like this?

You put some nice tricks in there…