ale*_*nco 0 html php content-management-system
这是Stacy的模板语言(一种不使用数据库的超轻HTML/PHP 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>
Run Code Online (Sandbox Code Playgroud)
我不知道如果这些@并:会产生某种问题?这是一个不好的做法,因为不是有效的HTML也不是PHP?
这是一个不好的做法,因为不是有效的HTML也不是PHP?
只要模板引擎生成的最终结果是有效的HTML,就没有根本问题.模板本身永远不会显示给最终用户,只会显示结果.
但是,这种语法会破坏HTML IDE的突出显示,或者在使用WYSIWYG编辑器编辑模板文件时可能会出现问题.如果你做了很多(或者让一个非编程人员编辑模板),你最好还是寻找一个具有HTML兼容模板格式的引擎(虽然我不能想到一个在我的顶部头.)
这绝对是大多数模板引擎运行的方式.