Yii Framework Forum: Modules and view default extension - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Modules and view default extension Weird behavior Rate Topic: -----

#1 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 17 November 2015 - 10:10 AM

I am using the Tale Jade Yii renderer with Yii and it works great, except for modules.

I am setting the default view extension to '.jade' and everything works with Yii::Application: if I have two view files like 'account.php' and 'account.jade', Yii will intelligently use the Jade version.

However, for modules, the behaviour is quite funky. ;D


I am using Dektrium/yii2-user and I have setup the pathmap for the view component.

It works for php views, but when I change the overridden views to jade views, Yii rudely chooses to use the php versions from the user module..

BUT...!

If I create an empty view file in the Dektrium view folder, Yii suddenly chooses to respect my rules :lol:


For example:

I have '@common/views/profile/show.php' and Yii does indeed use that instead of '@dektrium/user/views/profile/show.php'

When I change '@common/views/profile/show.php' to '@common/views/profile/show.jade' I would expect Yii to use that, but it doesn't.

So, I create a completely empty show.jade and drop it in '@dektrium/user/views/profile/' and it works - Yii uses my overridden jade view file. :P
Even if the original 'show.php' view file is present.


This must be a bug, right?
"Less noise - more signal"
0

#2 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 3,694
  • Joined: 10-October 10
  • Location:Denmark

Posted 17 November 2015 - 10:15 AM

It looks like Yii is checking the original view directory to see if a template with the default extension is present.
It should use the pathmap!

I know that I can work around this by dropping empty jade files in my vendor directory (@dektrium/..) but that is not optimal, even if I am not technically changing anything..
"Less noise - more signal"
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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