回归所见所得的的设计 -Tagfeather 用于 wordpress 主题的实例
时间:2008-01-31
来源:互联网
用 TagFeather 模板来改造现有 wordpress 主题,回归所见所得的设计
实例
http://www.dvaknheo.com/wordpress/
原来的 wordpress 默认模板,在 dreamweaver 中查看
用 tagfeather 改造的默认模板也是在 dw 中预览
按 ctrl+shift+I 去除向导线
实际浏览器效果
你可以到 www.dvaknheo.com 下载这个模板。
说明一下, 记得 cache 目录和 log 目录要可写哦
看一下 cache 目录的缓存文件,比较一下 smarty 的缓存文件.
另 tagfeather 默认是根据文件时间来判断是否要重新生成缓存文件的,调试的时候请注意
过年这几天很难接触电脑了。就暂时放出来,实际上还是没能赶在年前测试完.
作者: dvaknheo 发布时间: 2008-01-31
index.php
PHP代码:
<?php
require_once(TEMPLATEPATH.'/'.'common.inc.php');
if(TagFeather::Template(__FILE__)){return;}else{TagFeather::AllowInclude();}
return;
?>
<fieldset parser:notag="yes" parser:notext="yes" style="display:none; z-index:1; position:absolute;" >
<legend>配置</legend>
<span php:assign="quick" class="_posttime" parser:notag="yes" php:block="<?php the_time('F jS, Y') ?>" >
class="_posttime" 发表的【月,日,年】
</span>
<div php:assign="quick" class="entry" php:block="<?php the_content('Read the rest of this entry »'); ?>">---</div>
<p>
<span php:assign="quick" assign:notshow="yes" class="_tags" php:block="<?php the_tags('Tags: ', ', ', '<br />'); ?>">Tag列表</span>
<span php:assign="quick" assign:notshow="yes" class="_category" php:block="<?php the_category(', ') ?>"></span>
<span php:assign="quick" assign:notshow="yes" class="_edit" php:block="<?php edit_post_link('Edit', '', ' | '); ?>"></span>
<span php:assign="quick" assign:notshow="yes" class="_comment" php:block="<?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>"></span>
</p>
</fieldset>
PHP代码:
<!--#include file="header.html" --><div id="get_header">页眉</div>
<div id="content" class="narrowcolumn _if_have_posts">
<div class="post _post_id _while_theposts">
<h2><a href="#" class="_permalink">【文章标题】</a></h2>
<small><span class="_posttime">【January 20th, 2008】</span></small>
<div class="entry">
文章内容<br />
内容内容内容内容内容内容内容内容内容内容
内容内容内容内容内容内容
内容内容内容内容内容内容内容内容
内容内容内容内容<br />
【附加一下内容】<br />
<div class="_notshow"> Read the rest of this entry »</div>
</div>
<p class="postmetadata">
<span class="_tags">Tags: 【标签1,标签2<br/>标签3】</span>
Posted in <span class="_category">【分类1,分类2,分类3】</span> |
<span class="_edit"> Edit 【编辑1 编辑2|编辑3】</span>
<span class="_comment"> 【没有评论 / (1)评论 /[2]评论s】 </span>
</p>
</div>
<div class="post _post_id _while_theposts">
<h2><a href="#" rel="bookmark" title="Permanent Link to the_title_attribute" class="_permalink">这里不会输出</a></h2>
<small><span class="_posttime">【January 20th, 2008】</span></small>
<div class="entry">
【文章内容,如果没有则用以下代替】<br />
Read the rest of this entry »
</div>
<p class="postmetadata">
<span class="_tags">Tags:标签1,标签1<br/>标签1,标签1,标签1</span>
Posted in <span class="_category">分类1,分类2,分类3</span> |
<span class="_edit"> 编辑1|编辑2|编辑3</span>
<span class="_comment"> (1)评论 </span>
</p>
</div>
<div class="post _post_id _while_theposts">
<h2><a href="#" rel="bookmark" title="Permanent Link to the_title_attribute" class="_permalink">这里不会输出</a></h2>
<small><span class="_posttime">【January 20th, 2008】</span></small>
<div class="entry">
【文章内容,如果没adfsdafdsa有则用以下代替】<br />
Read the rest of this entry »
</div>
<p class="postmetadata">
<span class="_tags">Tags:标签1,标签1<br/>标签1,标签1,标签1</span>
Posted in <span class="_category">分类1,分类2,分类3</span> |
<span class="_edit"> 编辑1|编辑2|编辑3</span>
<span class="_comment">[2]评论s </span>
</p>
</div>
<div class="navigation">
<div class="alignleft _next_posts_link">« Older Entries</div>
<div class="alignright _previous_posts_link">Newer Entries »</div>
</div>
<div class="_else">=====无帖子时=====</div>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isnt here.</p>
<div id="_searchform">搜索框</div>
<!--#include file="searchform.html" -->
</div>
<div id="get_sidebar">侧栏</div>
<!--#include file="sidebar.html" -->
<div id="get_footer">页脚</div>
<!--#include file="footer.html" -->
PHP代码:
<?php
//Cache By TagFeather Version $Id: tagfeather.inc.php 23 2008-01-30 15:58:56Z dvaknheo $
//source /home/dvaknheo/domains/dvaknheo.com/public_html/wordpress/wp-content/themes/wp-tf/index.html Time 2008-01-31 00:25:26 MD5
//In index.html.cache.php Time 2008-01-31 01:02:03 MD5 b0174ed1a94407125549548d4808f7fa (MD5 no include this server block)
//timecost:0.0866878032684
if(!$GLOBALS['TF_IN_CACHE']){exit('TagFeather:permission deny');}
?>
<?php get_header(); ?>
<div id="content" class="narrowcolumn"><?php if (have_posts()) { ?>
<?php while (have_posts()) { the_post(); ?><div class="post" id="post-<?php the_ID(); ?>">
<h2><a href="<?php the_permalink() ?>" class="_permalink" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<small><?php the_time('F jS, Y') ?></small>
<div class="entry"><?php the_content('Read the rest of this entry »'); ?></div>
<p class="postmetadata">
<span><?php the_tags('Tags: ', ', ', '<br />'); ?></span>
Posted in <span><?php the_category(', ') ?></span> |
<span><?php edit_post_link('Edit', '', ' | '); ?></span>
<span><?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></span>
</p>
</div><?php } ?>
<div class="navigation">
<div class="alignleft"><?php next_posts_link('« Older Entries') ?></div>
<div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div>
</div>
<?php } else {?>
<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php include (TEMPLATEPATH . "/searchform.php"); ?>
<?php } ?></div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
PHP代码:
<?php
require_once(dirname(__FILE__)."/"."tagfeather.inc.php");
require_once(dirname(__FILE__)."/"."translog.inc.php");
translog(dirname(__FILE__)."/log/",true);
function tf_modifier_default($flag,$tf,$type)
{
$tf->cache_dir=dirname( __FILE__ ) .'/cache';
$tf->reg_parsehook('comment','tf_ssi_delinclude','tf_ssi_delinclude');
$source=$tf->source;
$filename=dirname($source).'/'.basename($source,'.php').'.html';
if(file_exists($filename)){
$tf->source=$filename;
$tf->struct_files[]=$source;
$tf->struct_files[]="structs.tf.php";
$tf->is_forcebuild=true;
if(basename($source)=='footer.php'){
}
}
return $flag;
}
function tf_ssi_delinclude($comment,$tf,$type)
{
$include="<!--#include";
if(substr($comment,0,strlen($include))==$include){
$tf->stop_nexthook();
//$tf->hookreturnblank();
$tf->V='';
return '';
}
return $comment;
}
?>
PHP代码:
<?php
require_once(dirname(__FILE__)."/"."tagfeather.inc.php"); //包含 tagfeather库
require_once(dirname(__FILE__)."/"."translog.inc.php"); //错误日志重定向
translog(dirname(__FILE__)."/log/",true); //把日志定向到 /log/【$_SERVER['SCRIPT_FILENAME']】.log
function tf_modifier_default($flag,$tf,$type)
{
//// 这个 modifier 钩子在 TagFeather::Template () 中会被调用 $flag 决定是否要编译
$tf->cache_dir=dirname( __FILE__ ) .'/cache'; // 重定向 缓存位置 使其在模板的 cache 文件夹下,默认是和执行脚本同一层的文件夹的cache 文件夹
$tf->reg_parsehook('comment','tf_ssi_delinclude','tf_ssi_delinclude'); // 添加下面的 tf_ssi_delinclude 函数作为 comment 注释钩子
$source=$tf->source;
$filename=dirname($source).'/'.basename($source,'.php').'.html';
if(file_exists($filename)){
$tf->source=$filename; // 把 模板源文件定为 【index】.html 而不是 【index】.php 文件
$tf->struct_files[]=$source; // 添加结构 文件 【index】.php 即解析的时候附加 【index】.php 。
$tf->struct_files[]="structs.tf.php"; // 添加结构文件 【structs.tf.php】
$tf->is_forcebuild=true; // 每次调用都强行编译,调试的时候打开,正常情况关闭
if(basename($source)=='footer.php'){ // 调试用
}
}
return $flag;
}
function tf_ssi_delinclude($comment,$tf,$type)
{
//解析到 <!-- --> 的时候会调用 $comment 表示注释的全部内容
$include="<!--#include"; //删除 SSI include 标记
if(substr($comment,0,strlen($include))==$include){
$tf->stop_nexthook(); //阻止下一个钩子
//$tf->hookreturnblank();
$tf->V=''; // 清空快速返回的值 ,以便能返回空值
return '';
}
return $comment;
}
?>
作者: dvaknheo 发布时间: 2008-01-31
下一个目标:
wiki 皮肤
年后再说了
作者: dvaknheo 发布时间: 2008-01-31
还有谁的模板实现 所见所得的?
作者: dvaknheo 发布时间: 2008-02-04
准备改wp做一个cms
作者: psdshow 发布时间: 2008-02-05
作者: dwp34998 发布时间: 2008-02-07



作者: luzhou 发布时间: 2008-02-26



作者: nianjin 发布时间: 2008-03-06
http://www.dvaknheo.com/bbs/forumdisplay.php?fid=8
现在缺一个 QQ 群
作者: dvaknheo 发布时间: 2008-03-06
在求职的敏感时期,我不愿意在论坛多说。
但现在,基本上理想的公司都无望了,欢迎北京海淀区有理想的公司骚扰。
顺便汇报一下进展情况
稳定版本后,我加了注释,又不知道哪里做了什么除 Bug 修改
现在麻烦问题来了:重构
我现在把 TagFeather 类 的很多函数转到 TF_Builder ,重命名为 TF_Compiler
TF_Compiler 继承 TF_Handle ,TF_Handle 就是 TF_XmlParser 的回调
钩子中调的 TagFeather $tf 参数 也改成 TF_Compiler $tfc
但是前几天我又觉得用
TagFeather extends TF_Compiler 好一些,改动也小一些。
所以又做了一个版本
但这两个版本都没有传到 googlecode
这些重构使得 类似 css selector 的 php:assign 卡壳
本来这个是更重要的部分
作者: dvaknheo 发布时间: 2008-04-09
允许起中文变量名就叫所见即所得了吗??
要是这样的话,未免太容易 了啊。
作者: wangchun 发布时间: 2008-04-16
而是要像smarty那样,以实现业务逻辑与显示逻辑的分离为目的。
这样才能使得代码结构尽可能的清晰。
作者: fhjr999 发布时间: 2008-05-12
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28