简体   繁体   English

需要的意见:来自PHP的自定义HTML标记(带有或不带有标签前缀)

[英]Opinions Required: Custom HTML Markup from PHP with or without tag prefix

I've created a class in PHP that allows you to create custom HTML markup. 我在PHP中创建了一个类,该类允许您创建自定义HTML标记。 It basically works a bit like FB Markup or EE tags. 它的工作原理基本上类似于FB标记或EE标签。 It works off a tag prefix, so you can add tags like this. 它可以使用标签前缀,因此您可以添加这样的标签。

<ctag:pagination per_page="20" total="500" page="0" base="http://localhost/page?page={page}" mode="smart" adjecents="5" />

My question is: Is the markup above better than the markup below? 我的问题是:上方的标记比下方的标记好吗? I'm asking as I'm considering branching my code to rework the tag matching so you can just generate custom html elements. 我问我是在考虑分支我的代码来重做标签匹配,以便您可以生成自定义html元素。 It would well for a drop in HTML5 replacement service. 减少HTML5替换服务将是一个很好的选择。 Match the User Agent for a none HTML5 browser and replace the HTML5 elements with your own replacements. 匹配无HTML5浏览器的用户代理,并用您自己的替换替换HTML5元素。

<pagination per_page="20" total="500" page="0" base="http://localhost/page?page={page}" mode="smart" adjecents="5" />

PS, if anybody wants to look at the class I've put a download here . 附言:如果有人想看这堂课,我在这里下载

Well it really depends on how you see it. 好吧,这实际上取决于您如何看待它。

To me the markup below is better but in with future markup tags that may pop up here and there, yours may conflict. 对我来说,下面的标记更好,但将来的标记标签可能会在这里和那里弹出,您的可能会发生冲突。

The prefix indicates more or less that its yours and its to not be mixed up with someone Else's code. 前缀或多或少表明它是您的,并且不要与其他代码混淆。

I'm sure that there are many other opinions but this is mine. 我敢肯定还有很多其他意见,但这是我的。

I'd go with the first one, because a man can still hope that someday, maybe, browsers will finally support XHTML with namespaces . 我会选择第一个,因为一个人仍然可以希望有一天,也许浏览器最终会支持带有命名空间的XHTML It also cannot hurt to stick to an established standard, in case some wants to parse your markup with an XML Parser. 如果有人想用XML解析器解析您的标记,那么遵循既定标准也不会有任何伤害。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM