Remove @ from layout template file name

6 years ago

Honza Marek
Member | 1674
+
0
-

I don't think there is any reason to have @ character in layout template file name. It just complicate stuff, so it should be removed.

BC break: No. Method formatLayoutTemplateFile can be changed backward compatible.

6 years ago

Majkl578
Moderator | 1379
+
0
-

It just complicate stuff, so it should be removed.

How?

6 years ago

Jan Tvrdík
Nette guru | 2563
+
0
-

I don't think there is any reason to have @ character in layout template file name

Yes, there is. You can have a special @layout.latte for a specific presenter (app/templates/Sign/@layout.latte). Removing the @ would allow the template to be misused for action layout.

6 years ago

Patrik Votoček
Member | 2249
+
0
-

I agree with @Jan Tvrdík

6 years ago

Felix
Nette Core | 957
+
0
-

I like a name @layout.latte, so agree with @Jantvrdik etc.

6 years ago

David Grudl
Nette Core | 6886
+
0
-

The @ character with this exist as prevention against „URL attacks“ like example.com?presenter=xxx&action=layout. It can be removed if you propose any different solution.

6 years ago

Honza Marek
Member | 1674
+
0
-

Other templates can be misused for actions too. I sometimes create partial templates right next to the action templates – menu.latte, someItemBox.latte, … I know I have to be careful with this. Maybe I should start partial template names with ugly @ sign too.

Ideal solution for me would be obligatory action/render methods for actions in presenters. Unfortunately it would break backward compatibility a lot.

6 years ago

David Grudl
Nette Core | 6886
+
0
-

Yes, you should prefix them (with any \W character) or move them to special folder.

6 years ago

Milo
Nette Core | 1151
+
0
-

Security reasons to preserve @ has been mentioned. If you propose another solution, please, open new RFC with description. For your needs, you can overload Presenter::formatLayoutTemplateFiles().