Unified views addressing

There are several different ways you can address view file right now.

  • relative to controllers viewPath

  • notation with slashes (i.e //layouts/main which points to /protected/views/layouts/main.php)

  • notation with dots (using Yii aliases) - i.e. modules.views.controller.specificview

Looks fine, but there are incompatibilities between those methods and limitations of usage…

Case 1:

We have module "module" with models, components, and so on. One component renders CListView widget and should point to view that renders rows of this list. This view should be placed in modules views directory, so you can specify: "module.views.default._view". Works pretty fine event when this components is used from inside another modules controller, but… you cannot use themes to override this view. Dot notation is always pointing to specific single file with view (in this case: /protected/modules/module/views/default/_view.php). Event if you put /themes/classic/views/module/default/_view.php - framework will ignore this file in this case.

Case 2:

Using slash notation (and relative one) you can use themes to override every single view specified in this way (/default/_view), but… you can address only views in current controllers scope (current module viewPath or application viewPath with double slashes at beginning) but you cannot point to view from another module (like in case #1). So - when using relative addressing or slash-addressing framework will look for /themes/classic/views/module/default/_view.php and use it if found.

Now - would be great if one could address any view in application no matter in which module it is… maybe there could be linux "~user" notation adopted, so you could specify: //~module/controller/view or //~module/~submodule/…/~subnmodule/controller/view

In my case only single level of module nesting would work fine… what do you think?

Or maybe I am missing something and my cases can be solved using current framework?