This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

emzero439
emzero439

October saves every layout, partial and page as .htm. Most Twig supporting IDEs (PhpStorm) are expecting .html.twig extension for Twig files. I know October files are not exactly Twig files (because of everything before ==), but I guess they are more closer to Twig than plain HTML.

I think a .html.twig or even a custom extension would be useful to map the corresponding language in our IDEs.

daftspunky
daftspunky

We use .htm instead of .html for this reason. So you can remap .htm as Twig and keep using .html as HTML if necessary.

Is it not possible to remap file types in PhpStorm?

a.smith2051
a.smith2051

I would also like to know the reason for this in the backend plugins, why not .php for the plugin views rather than .htm, .htm doesn't show PHP auto type hinting in PHPStorm. And I also agree that the frontend templates should have been .html.twig as this is a normal convention used by Symfony and others. It just seem ackward to have PHP in a .htm file.

that0n3guy
that0n3guy

@daftspunk: yes you can remap file types.

This relates: https://github.com/octobercms/october/issues/263 . Just a note, I agree w/ the questions in this thread. The .htm (if set as twig) in php storm does not show php autotype hinting and it would still be nice if blade templates could be used on backend views.

Last updated

Flynsarmy
Flynsarmy

Allowing blade templates for backend views could confuse new and even existing users. I can only imagine all the "Why is blade working here but not here?" forum posts...

that0n3guy
that0n3guy

There are lots of confusing things about any software project so thats not really a reason not to do something. Also, that is no different than the current question being asked. I've seen the "why not blade" question asked a ton of times.

I'm fine not using blade for backend views... but at least use twig. I hate going back to <? ?> stuff... it feels like taking a step backwards.

RomaldyMinaya
RomaldyMinaya

I agree with you @that0n3guy. When you start using the incredible Laravel framework you start using and get used to all the functionalities that the framework gives you. So in the back end you have to use twig but in some cases need to use <? ?>. That's a little confusing at developing time.

Last updated

daftspunky
daftspunky

Blade's syntax is too radical, all other template languages are zigging, while Blade is zagging. It's alright if you prefer Blade, but you have to understand the decision to use PHP (and Twig) is for accessibility reasons.

For example, personally I believe SCSS is a far better CSS pre-compiler, however LESS is more widely used and accepted. It is selfless to use the things that are good enough and hold the majority share of users. Otherwise we risk alienating ourselves, as you'll find perhaps Laravel has done for you with Blade.

With regards to type-hinting in view files, perhaps you should be asking why you need type hinting? Templates should contain minimal business logic, only variables, if-then-else, etc. PHP is both a programming language and a ["pure"] templating language, this distinction is made by the difference in file extension.

Last updated

durika.d23488
durika.d23488

Hi guys, any luck with setting up phpStorm to support <?php function onStart() {...} ?> in .htm twig file?

Eoler

1-10 of 10

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.