20
回答
PHP 模板
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Welcome to application Center!</title> 
<script src="{site}js/jquery-1.6.2.min.js"></script>
<script src="{site}js/jquery.tools.min.js"></script>
<script src="{site}js/jquery.uploadify.js"></script>
<script src="{site}js/cmsadmin.js"></script>
<script src="{site}js/markitup/jquery.markitup.js" ></script>
<link rel="stylesheet" type="text/css" href="{site}css/style.css">
<script type="text/javascript">
	$(document).ready(function(){
			$("#loading").ajaxStart(function(){
				$(this).show();
				});
			$("#loading").ajaxStop(function(){
				$(this).hide();
				});
			});
</script>
</head>
<body>
	<div id="header">
		<div id="globalLinks">
			<ul>
				<li><span>|</span><a href="#">setting</a></li>
			</ul>
		</div>
		{if:isset(user)}
		<div id="welcome">Welcome <a href="#">{user.username}</a> <a href="{site}home/logout">logout</a></div>
		{end}
		<div class="clear"></div>
		{if:menus}
		<div id="moduleList">
			<ul>
			{foreach:menus,menu}
			<li {if:menu.is_active} class="current" {end}><div><a href="{site}{menu.m_uri}/" id="moduleTab_Site">{menu.m_label}</a></div></li>
			{end}
			</ul>
		</div>
		{end}
		<div class="line" style="clear:both;"></div>
		{if:shortcuts}
		<div id="shortcuts" class="headerList">
			<b style="white-space:nowrap;">Actions:&nbsp;&nbsp;</b>
			{foreach:shortcuts,shortcut}
			<span style="white-space:nowrap;">
			       	<a href="{site}{shortcut.c_uri}/{shortcut.a_name}">{shortcut.a_label}</a>
			</span>
			{end}
		</div>
		{end}
		<div id='errmsg' name='errmsg'></div>
		<div class="clear"></div>
	</div>
<div id="main">
<div id="content">
{if:isset(content)}
{content}
{end}
</div>
</div>
<div id='loading'><div><img src="{site}css/images/loading.gif" /><span> Processing</span></div></div>
<div id="footer">
	<div id="performance">Response time {execution_time}s memory{memory_usage}</div>
	<div id="copyright">©2011 *****.com Inc.</div>
</div>
</body>
</html>

举报
宏哥
发帖于6年前 20回/1K+阅
共有20个评论 最后回答: 4年前

对应的 PHP编译文件

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Welcome to  application Center!</title> 
<script src="<?php echo $this->data->site; ?>js/jquery-1.6.2.min.js"></script>
<script src="<?php echo $this->data->site; ?>js/jquery.tools.min.js"></script>
<script src="<?php echo $this->data->site; ?>js/jquery.uploadify.js"></script>
<script src="<?php echo $this->data->site; ?>js/cmsadmin.js"></script>
<script src="<?php echo $this->data->site; ?>js/markitup/jquery.markitup.js" ></script>
<link rel="stylesheet" type="text/css" href="<?php echo $this->data->site; ?>css/style.css">
<script type="text/javascript">
	$(document).ready(function(){
			$("#loading").ajaxStart(function(){
				$(this).show();
				});
			$("#loading").ajaxStop(function(){
				$(this).hide();
				});
			});
</script>
</head>
<body>
	<div id="header">
		<div id="globalLinks">
			<ul>
				<li><span>|</span><a href="#">setting</a></li>
			</ul>
		</div>
		<?php if(isset($this->data->user)) {  ?>
		<div id="welcome">Welcome <a href="#"><?php echo $this->data->user->username; ?></a> <a href="<?php echo $this->data->site; ?>home/logout">logout</a></div>
		<?php } ?>
		<div class="clear"></div>
		<?php if($this->data->menus) {  ?>
		<div id="moduleList">
			<ul>
			<?php foreach($this->data->menus as $this->data->menu) {  ?>
			<li <?php if($this->data->menu->is_active) {  ?> class="current" <?php } ?>><div><a href="<?php echo $this->data->site; ?><?php echo $this->data->menu->m_uri; ?>/" id="moduleTab_Site"><?php echo $this->data->menu->m_label; ?></a></div></li>
			<?php } ?>
			</ul>
		</div>
		<?php } ?>
		<div class="line" style="clear:both;"></div>
		<?php if($this->data->shortcuts) {  ?>
		<div id="shortcuts" class="headerList">
			<b style="white-space:nowrap;">Actions:&nbsp;&nbsp;</b>
			<?php foreach($this->data->shortcuts as $this->data->shortcut) {  ?>
			<span style="white-space:nowrap;">
			       	<a href="<?php echo $this->data->site; ?><?php echo $this->data->shortcut->c_uri; ?>/<?php echo $this->data->shortcut->a_name; ?>"><?php echo $this->data->shortcut->a_label; ?></a>
			</span>
			<?php } ?>
		</div>
		<?php } ?>
		<div id='errmsg' name='errmsg'></div>
		<div class="clear"></div>
	</div>
<div id="main">
<div id="content">
<?php if(isset($this->data->content)) {  ?>
<?php echo $this->data->content; ?>
<?php } ?>
</div>
</div>
<div id='loading'><div><img src="<?php echo $this->data->site; ?>css/images/loading.gif" /><span> Processing</span></div></div>
<div id="footer">
	<div id="performance">Response time <?php echo $this->data->execution_time; ?>s memory<?php echo $this->data->memory_usage; ?></div>
	<div id="copyright">©2011 *******.com Inc.</div>
</div>
</body>
</html>

话说我最近想出个比较古怪的逻辑与表现分离的实现思路,而且正在用,有时间发上来给大家乐一乐。基于PHP的哈。

引用来自“Liuxd”的答案

话说我最近想出个比较古怪的逻辑与表现分离的实现思路,而且正在用,有时间发上来给大家乐一乐。基于PHP的哈。

去想着劳什子做啥,这不已经发出来了。

这个使用 Vemplator渲染的。恐怕我是唯一的推广者了。有个以前的朋友居然通过搜索vemplator把我给挖出来。

vemplator 是一个最强的PHP模板类,一个文件,总共220行不是最强之一,就是最强.

--这个就是宏哥对它的评价,不过我应用的时候,对它进行了一些小的修补。

--- 共有 1 条评论 ---
大东哥220行代码,好,我喜欢。 6年前 回复
顶部