Hi,
I have the following structure:
-protected
–modules
—admin
----modules
-----core
------controllers
-------IndexController.php
------views
----views
-----layouts
------main.php
-----CoreModule.php
As you can see i am using modules and child modules. Now this works fine. I would like to point your attention to one of the features available within Yii framework, The layouts.
At this time all i did was to add main.php to the admin/views/layouts/ directory and i hoped that all my child modules controllers will use that layout file.
Now when i create and add the main.php layout file to the admin/modules/core/views/layouts directory it feeds from that directory as it should, How ever when i remove that file it won’t print any layout even though the layout exists in the parent module which is the admin module.
Now When i ever i add the same layout file into the directory Protected/views/layouts with the name main.php as the default name used by the framework it does work and uses that layout from that path (Protected/views/layouts/main.php).
Now according to the Documentation and i quote
CWebModule:
“the layout that is shared by the controllers inside this module. If a controller has explicitly declared its own layout, this property will be ignored. If this is null (default), the application’s layout or the parent module’s layout (if available) will be used. If this is false, then no layout will be used.”
Notice the highlighted text that explains that if the property left as it is by default which is Null then it will try to locate it through the currently used module layout directory (admin/modules/core/views/layouts/main.php) Other wise it will try to look for the layout under the applications layouts (Protected/views/layouts/main.php) If both fails (I assume) then it will try to look for under it’s parent module layout path (modules/admin/views/layouts/main.php). The first two options works
admin/modules/core/views/layouts/main.php
Protected/views/layouts/main.php
If i remove both of them the third one which should work as well if the first two fails, Fails as well.
I was wondering if anyone encountered this issue or maybe this is a bug and needs reporting.
Any help will be appreciated.