Yii Framework Forum: Subdirectories Controllers and Views - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Subdirectories Controllers and Views Rate Topic: -----

#1 User is offline   Maxximus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 146
  • Joined: 24-November 08
  • Location:Spain

Posted 26 November 2008 - 01:30 PM

Currently an url with a ControllerID resolves with UCfirst or with all lowercase. This is not the case for a directory prefix like path.to.ControllerID [when used with *NIX].

Would like to suggest to lowercase the full ControllerID path, and (by convention) UCfirst the ControllerID. This way upper/lowercase url typos will resolve always.

This will mean all paths under controller needs to be lowercase by convention.

Besides that was wondering why a path to a view in a subdirectory doesn't use the dotted Path Alias.

0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,875
  • Joined: 04-October 08
  • Location:DC, USA

Posted 26 November 2008 - 01:42 PM

The doc is not very accurate. For controllers organized in subdirectories, only the class name part is upper-cased. The rest are kept as it is.

The main reason for using slashes in view paths is because sometimes we need to specify a view like '/path/to/view'. Using a dot would make it look like '.path.to.view', not as intuitive as the former.
0

#3 User is offline   Maxximus 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 146
  • Joined: 24-November 08
  • Location:Spain

Posted 26 November 2008 - 05:39 PM

Okay, but now http://domain/admin.user/ and http://domain/admin.User/ both resolve to controlles/admin/UserController.php. Thats good.

Someone using caps lock by accident (entering HTTP://DOMAIN/ADMIN.USER/) will get a 404 for sites running on Linux. Thats not necessary, since it could be easily corrected according to convention.

The reason I mentioned views using slashes and not path alias, not a big deal, but its used almost everywhere else, so perhaps would be more consistent, and will give the opportunity to store some of them at another place without touching the controller files. For instance: beta layout etc.

*EDIT* About the views: plenty options with themes for that. Sorry, still very new to Yii  :-\
0

#4 User is offline   notzippy 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 201
  • Joined: 06-October 08

Posted 27 November 2008 - 05:04 PM

Using slashes is a large security risk - people could then attempt to exploit your website by doing request for ../../../../pwd.etc and the likes with the dot notation regardless of the type of request they can never leave the "application" folder because ever dot will be translated to a "/" so the above request would look for a file in your "application//////////pwd.etc"

If you want to use the slashes you should look more into the CUrlManager

nz
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users