How to use custom templates in gii (using Yii 2)

时光毁灭记忆、已成空白 提交于 2019-12-10 12:46:47

问题


I'm trying to find a way to use custom Gii templates for Yii 2, but looking at the missing documentation in the docs, I assume it's not possible yet? Or am I missing something?


回答1:


Copy ie. the crud generator templates from gii/generators/crud/templates to your application app/templates/mycrud.

Then define the templates in your config:

$config['modules']['gii'] = [
    'class'      => 'yii\gii\Module',
    'generators' => [
        'crud'   => [
            'class'     => 'yii\gii\generators\crud\Generator',
            'templates' => ['mycrud' => '@app/templates/mycrud']
        ]
    ]
];

Until the documentation is finished you may also have a look at my Gii extension how to create a custom generator and templates.



来源:https://stackoverflow.com/questions/22379766/how-to-use-custom-templates-in-gii-using-yii-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!