这是Stacy模板语言(超轻HTML/PHP CMS不使用数据库)创建不是有效的HTML或PHP(Stacy CMS)的模板语言是否是不好的做法?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>@title, @name's Portfolio </title>
<link rel="alternate" type="application/atom+xml" href="@root_path/?/feed/">
<link rel="stylesheet" href="@root_path/public/docs/css/screen.css" type="text/css" media="screen">
</head>
<body>
<div id="container">
<h1 class="col three">
<a href="@root_path">@name</a>
<strong>@profession</strong>
</h1>
<em class="col three">@email</em>
<hr>
:navigation
<div id="content" class="col eight">
<p class="date col one">@date</p>
<div class="description col six">
<h2 class="col six"><a href="@root_path">@title</a></h2>
@content
</div>
<hr>
<p id="project-count" class="col one"><em>№</em> @index/@siblings_count</p>
<p id="gallery-count" class="col one">
<em>№</em> <span>1/1</span>
</p>
<div id="gallery-navigation" class="col three">
<p><a href="#" id="next-image">Next image</a> <em>→</em></p>
<p><a href="#" id="previous-image">Previous image</a> <em>←</em></p>
</div>
<div class="col four">
if $siblings do
:next-page
:previous-page
endif
</div>
:media
</div>
我不知道如果这些@
和:
会产生某种问题?由于HTML和PHP无效,这是否是一种不好的做法?
我假设'@ index'(和其他'@'-prefaced变量)的各种实例只是来自别处的值的占位符。它看起来像模板可以从这个模板输出有效的(x)html。参考:http://staceyapp.com/documentation/variable-types/variables/ – 2011-04-10 15:19:06
@大卫托马斯是的,它是。所以只要输出结果是有效的HTML,这并不重要? – alexchenco 2011-04-10 15:19:59
这个模板并不重要,因为这只是将信息插入其中的框架,然后输出到浏览器。有一些论据表明无效的html页面也有它们的位置,并不一定是个问题,这取决于它们的目的/使用情况。请参阅:http://stackoverflow.com/questions/994856/so-what-if-custom-html-attributes-arent-valid-xhtml,以及http://stackoverflow.com/questions/1337928/whats-the-point -of-valid-css-html(在许多其他许多...中)。 – 2011-04-10 15:22:22