October: Feature request: Split the .htm files

Created on 6 Nov 2018  路  4Comments  路  Source: octobercms/october

Because the forum is in read-only mode, I opened my feature request here: "This forum is in read-only mode. Please continue to browse, but replying and other actions are disabled for now."

I really love october cms, but there is one thing I don't really like: The .htm files for page/meta/layout/etc definitions.
I don't like them for the following reasons:

  • It's a html file but not html syntax, this is confusing machines and humans.
  • My IDE can't read the file and shows warnings. (using filetype:twig helps but doesn't solve the problem)
  • The file structure is inflexible.

My idea to solve these issues: Instead of a .htm you could define a .yaml file. The .yaml file contains the configuration as it's currently in the first header. In the configuration file, the other file-dependencies are defined. This could look like the following:

example.yaml:

title: Example
url: /example
layout: default
code: example.php
template: example.html.twig

example.php

<?php

function onStart()
{
    $this['hello'] = "Hello world!";
}

example.html.twig

<p>{{ hello }} - Example Content</p>

Also <filename>.php and <filename>.html.twig could be the default values.

To keep backward compatibility we could first check for the .htm file and then for the .yaml file.

Question

All 4 comments

Don't get your point, so it's better to wait for @LukeTowers. But for me it's a bit odd feature request.

@reecube, if you use 'Intellij Idea' or 'PhpStrom', in Settings -> Editor -> File Types -> remove '.htm' from HTML "File Types" and add it to PHP. And here you go, everything works: styling, php, twig, html, js, autocompletion and etc.

@reecube we're not going to change the file type nor split the files up. I don't necessarily agree with using .htm as the extension of choice but your described issues are easily solved by changing your editor's configuration.

@w20k, the problem with "File types" changing in PhpStorm is that you can't set it for one project. This option will be applied to all PhpStorm projects and may cause problems with old OpenCart templates.

@Vadiok If that's the case, you'll have to make a feature request to Jetbrains to add that feature in, unfortunately. I'm not sure why it's not possible - VSCode, Atom and Sublime Text have had it for years.

Was this page helpful?
0 / 5 - 0 ratings