我应该对包含HTML片段的文件使用什么扩展名? [英] What extension should I use for files containing fragments of HTML?

查看:112
本文介绍了我应该对包含HTML片段的文件使用什么扩展名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

文件名后面的.html后缀意味着文档包含 html head body 标签。



我有一些文件,每个文件都包含 div 元素或两个元素,但不包含 html body 标记。文件内容是格式良好的HTML片段,因为它们可以插入兼容HTML文档的 body 标签中,并且仍然符合规范。 (它们不包含<%%> 标记,不包含PHP代码等)。但是,片段文件本身不兼容HTML,所以我想给它一个不同的命名约定。



几个文件扩展名站点包含一个.PHT条目并将其描述为部分超文本文件。这听起来很有希望,但我无法找到关于原点,预期文件格式或使用它的应用程序的任何其他解释。此外,许多相同的网站将PHP文件标识为.phtml和.phtm(它们似乎是.pht后缀的较长版本)—如上所述,我的文件不是PHP文件。



我应该使用.pht作为后缀吗?是否有更合适的命名约定?



编辑:
我想区分同一目录中完整HTML文档的片段文件。

解决方案我将使用 .inc (意思是包含文件)或 .txt


The ".html" suffix on a filename implies that the document contains html, head, and body tags.

I have some files that each contains a div element or two, but no html or body tags. The file contents are well-formed HTML fragments in the sense that they could be inserted into a body tag of a compliant HTML document, and it would still be compliant. (They contain no "<% %>" markers, no PHP code, etc.) But a fragment file is not compliant HTML by itself, so I'd like to give it a different naming convention.

Several "file extension" sites include an entry for ".PHT" and describe it as "Partial Hypertext File." That sounds promising, but I can't find any additional explanation on the origin, expected file format, or applications that use it. Also, many of the same sites identify ".phtml" and ".phtm" (which appear to be longer versions of the .pht suffix) as PHP files — as noted, my files are not PHP files.

Should I use ".pht" as a suffix? Is there a more appropriate naming convention?

Edit: I'd like to distinguish fragment files from the full HTML documents in the same directory.

解决方案

I would use .inc (meaning include file) or .txt.

这篇关于我应该对包含HTML片段的文件使用什么扩展名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆