Archive

Posts Tagged ‘模板’

今日杂碎:升级程序连带升级模板

June 20th, 2009

杂碎1:程序又升级啦,模板又要跟着升级啦!还是WP好啊,模板不用非要跟着程序升级,囧

这次在升级模板的时候,特别把修改的部分打上注释并且能和源程序代码分离的尽量分离,基本上修改的下次升级可以直接替换程序模板标签(比如这次的url链接模板标签),然后复制css里的一大块样式就可以直接使用了。

修改的部分单独自定义啦自己的标签名字(方便设置css),避免和官方程序混淆,div的完全闭合(保证下次升级尽量少的出错),css中自定义的样式单独放到结尾,然后使用注释标识清楚(下次就可以直接把这块复制走啦)。

这样下来下次升级模板就不用花很多时间啦。:)

升级后的 洛阳生活点评网:http://LuoYangLife.com/

杂碎2:今天查到百度联盟打的100¥

是18号打的(附注为:打款代收),这个算是第一笔从网络上支取的广告费啦!!

今日一点 , ,

在“singale post”页面添加“上一篇”与“下一篇”链接

March 27th, 2008

代码如下:添加到模板需要的位置即可

<div class="navigation">
<div class="alignleft"><?php previous_post_link('« %link') ?></div>
<div class="alignright"><?php next_post_link('%link »') ?></div>
</div>

效果:

wordpress支持, 今日一点 ,

在“singale post”页面添加“收藏此页到”标签

March 26th, 2008

这次没有在singal post页面直接添加“代码”而是单独建立一个模板页面:adds.php。

然后在single post模板中要出现的地方使用:

<?php include_once("add-to.php"); ?>

就ok啦。

效果图:

收藏此页到

add.php的代码是:
<div class=”socialtools”>
<h2 class=”social-title”>收藏此页到: </h2>
<?php
$UTITLE = the_title(”, ”, false);
$TITLE = urlencode($UTITLE);
$URL = get_permalink();
$URL = urlencode($URL);
//$IMAGES = get_theme_root_uri() . ‘/’ . get_template() . ‘/images/social/’;
$IMAGES = ‘/images/’;

print(‘<a href=”http://my.poco.cn/fav/storeIt.php?u=’.$URL.’&t=’.$TITLE.’&c=” title=”baidu”><img src=”‘.$IMAGES.’poco.gif” alt=”poco”></img></a>’);
print(‘<a href=”http://cang.baidu.com/do/add?iu=’.$URL.’&it=’.$TITLE.’&dc=&fr=js#nw=1″ title=”baidu”><img src=”‘.$IMAGES.’baidu.gif” alt=”baidu”></img></a>’);
print(‘<a href=”http://bookmark.hexun.com/post.aspx?url=’.$URL.’&title=’.$TITLE.’” title=”hexun”><img src=”‘.$IMAGES.’hexun.gif” alt=”hexun”></img></a>’);
print(‘<a href=”http://hot.yesky.com/dp.aspx?u=’.$URL.’&t=’.$TITLE.’” title=”yesky”><img src=”‘.$IMAGES.’yesky.gif” alt=”yesky”></img></a>’);
print(‘<a href=”http://www.365key.com/storeit.aspx?u=’.$URL.’&t=’.$TITLE.’” title=”360 sky”><img src=”‘.$IMAGES.’365key.gif” alt=”360 sky”></img></a>’);
print(‘<a href=”http://vivi.sina.com.cn/collect/icollect.php?pid=28&url=’.$URL.’&title=’.$TITLE.’” title=”sina vivi”><img src=”‘.$IMAGES.’vivi.gif” alt=”sina vivi”></img></a>’);
print(‘<a href=”http://myweb.cn.yahoo.com/popadd.html?url=’.$URL.’&title=’.$TITLE.’” title=”cn.yahoo.com”><img src=”‘.$IMAGES.’yahoo.gif” alt=”cn.yahoo.com”></img></a>’);

print(‘<a href=”http://del.icio.us/post?url=’.$URL.’&title=’.$TITLE.’” title=”del.icio.us”><img src=”‘.$IMAGES.’delicious.png” alt=”del.icio.us”></img></a>’);
print(‘<a href=”http://digg.com/submit?phase=2&url=’.$URL.’&title=’.$TITLE.’” title=”Digg”><img src=”‘.$IMAGES.’digg.png” alt=”Digg”></img></a>’);
print(‘<a href=”http://furl.net/storeIt.jsp?t=’.$TITLE.’&u=’.$URL.’” title=”Furl”><img src=”‘.$IMAGES.’furl.png” alt=”Furl”></img></a>’);
print(‘<a href=”http://blinklist.com/index.php?Action=Blink/addblink.php&Name=’.$TITLE.’&Description=’.$TITLE.’&Url=’.$URL.’” title=”Blinklist”><img src=”‘.$IMAGES.’blinklist.png” alt=”Blinklist”></img></a>’);
print(‘<a href=”http://reddit.com/submit?url=’.$URL.’&title=’.$TITLE.’” title=”Reddit”><img src=”‘.$IMAGES.’reddit.png” alt=”Reddit”></img></a>’);
print(‘<a href=”http://www.technorati.com/faves?add=’.$URL.’” title=”Technorati”><img src=”‘.$IMAGES.’technorati.png” alt=”Technorati”></img></a>’);
print(‘<a href=”http://myweb2.search.yahoo.com/myresults/bookmarklet?u=’.$URL.’&t=’.$TITLE.’” title=”Yahoo My Web”><img src=”‘.$IMAGES.’yahoo_myweb.png” alt=”Yahoo My Web”></img></a>’);
print(‘<a href=”http://www.newsvine.com/_wine/save?u=’.$URL.’&h={title” title=”Newsvine”><img src=”‘.$IMAGES.’newsvine.png” alt=”Newsvine”></img></a><br/>’);
print(‘<a href=”http://ekstreme.com/socializer/?url=’.$URL.’&title=’.$TITLE.’” title=”Socializer”><img src=”‘.$IMAGES.’socializer.png” alt=”Socializer”></img></a>’);
print(‘<a href=”http://ma.gnolia.com/bookmarklet/add?url=’.$URL.’&title=’.$TITLE.’&description=’.$TITLE.’” title=”Ma.gnolia”><img src=”‘.$IMAGES.’magnolia.png” alt=”Ma.gnolia”></img></a>’);
print(‘<a href=”http://www.stumbleupon.com/refer.php?url=’.$URL.’&title=’.$TITLE.’” title=”Stumble Upon”><img src=”‘.$IMAGES.’stumbleupon.png” alt=”Stumble Upon”></img></a>’);
print(‘<a href=”http://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk=’.$URL.’&title=’.$TITLE.’” title=”Google Bookmarks”><img src=”‘.$IMAGES.’google.png” alt=”Google Bookmarks”></img></a>’);
print(‘<a href=”http://www.rawsugar.com/tagger/?turl=’.$URL.’&tttl=’.$TITLE.’” title=”RawSugar”><img src=”‘.$IMAGES.’rawsugar.png” alt=”RawSugar”></img></a>’);
print(‘<a href=”http://www.squidoo.com/lensmaster/bookmark?’.$URL.’” title=”Squidoo”><img src=”‘.$IMAGES.’squidoo.png” alt=”Squidoo”></img></a>’);
print(‘<a href=”http://www.spurl.net/spurl.php?url=’.$URL.’&title=’.$TITLE.’” title=”Spurl”><img src=”‘.$IMAGES.’spurl.png” alt=”Spurl”></img></a>’);
print(‘<a href=”http://blinkbits.com/bookmarklets/save.php?v=1&source_url=’.$URL.’&title=’.$TITLE.’” title=”BlinkBits”><img src=”‘.$IMAGES.’blinkbits.png” alt=”BlinkBits”></img></a>’);
print(‘<a href=”http://netvouz.com/action/submitBookmark?url=’.$URL.’&title=’.$TITLE.’&popup=no” title=”Netvouz”><img src=”‘.$IMAGES.’netvouz.png” alt=”Netvouz”></img></a>’);
print(‘<a href=”http://www.rojo.com/add-subscription/?resource=’.$URL.’” title=”Rojo”><img src=”‘.$IMAGES.’rojo.png” alt=”Rojo”></img></a>’);
print(‘<a href=”http://blogmarks.net/my/new.php?mini=1&simple=1&url=’.$URL.’&title=’.$TITLE.’” title=”Blogmarks”><img src=”‘.$IMAGES.’bmarks.png” alt=”Blogmarks”></img></a>’);
print(‘<a href=”http://co.mments.com/track?url=’.$URL.’&title=’.$TITLE.’” title=”Co.mments”><img src=”‘.$IMAGES.’comments.png” alt=”Co.mments”></img></a>’);
print(‘<a href=”http://www.scuttle.org/bookmarks.php/maxpower?action=add&address=’.$URL.’&title=’.$TITLE.’&description=’.$TITLE.’” title=”Scuttle”><img src=”‘.$IMAGES.’scuttle.png” alt=”Scuttle”></img></a>’);
print(‘<a href=”http://feedmelinks.com/categorize?from=toolbar&op=submit&name={title}&url={link}&version=0.7″ title=”Feed me links”><img src=”‘.$IMAGES.’feedmelinks.png” alt=”Feed Me Links”></img></a>’);
print(‘<a href=”http://yigg.de/newpost.php?exturl=’.$URL.’” title=”Yigg”><img src=”‘.$IMAGES.’yigg.png” alt=”Yigg”></img></a>’);
print(‘<a href=”http://www.mister-wong.de/index.php?action=addurl&bm_url=’.$URL.’&bm_description=’.$TITLE.’” title=”Mr.Wong”><img src=”‘.$IMAGES.’wong.gif” alt=”Mr.Wong”></img></a>’);
?>
</div>
如果需要可以自行保存这里的图片。

标签css代码:
#singlecontent .socialtools {height: 100px;width:500px;margin: 0;padding: 0;background: transparent url(/images/social.gif) no-repeat right bottom;}
h2.social-title {margin: 0;padding: 20px 0 10px 3px;    background: none !important;font-size: 1.4em;}
.socialtools img  {border: 1px solid #edf2ff;padding:1px;}

wordpress支持, 今日一点 ,

专业的Wordpress模板

March 25th, 2008

Webmaster-Source上的31 Professional WordPress Themes中列出了31个免费和付费的Wordpress模版,大部分是新闻杂志型模版。

一、免费模版

1、Gridlock

Gridlock

2、Illacrimo

Illacrimo

3、Amazing Grace

Amazing Grace

4、StudioPress

StudioPress

5、Not So Fresh

Not So Fresh

6、Gluttony

Gluttony

7、SpringLoaded

SpringLoaded

8、InSense

InSense

9、Digital Pop

Digital Pop

10、Blogging Pro
Blogging Pro

11、ColdBlue
ColdBlue

12、GreenTech
GreenTech

wordpress支持 ,

仿豆瓣pbdigg模板readme.txt

March 4th, 2008

最简单的安装办法:按照我的目录结构直接上传到空间,然后到后台系统设置——功能设置——选择douban这个风格,就可以啦
若出现发表文章警告或是更新缓存警告,请看后边的解决办法。

演示地址:http://woaikan.clin003.com/
原模板地址:http://www.pbdigg.net/show/812-1

下载地址:仿豆瓣pbdigg模板下载

截图预览:

仿豆瓣pbdigg模板截图

这个模板在woaidushu.com基础上做的修改,修改的内容主要有:
调整顶上边的色块颜色为浅绿色
调整使“顶”旁边的“埋”可以看到
调整页面顶部的欢迎语句,使欢迎语和用户登录的用户名搭配,针对会员做欢迎词
修改ui语言语言中的myspace对应中文为“我的空间”,控制面板为——设置(这个想法主要是模仿豆瓣的,感觉豆瓣的这个词语要比pbdigg官方默认的这两个词语跟亲切些)

修改的连接地址有:退出地址,控制面板(设置)地址,发表文章地址
貌似还修改啦些地方,暂时想不起来啦。

自己动手按章模板办法:
1:首先上传模板文件比如douban到templates文件夹下
2:在data\style下建个douban.php内容可以复制pbdigg.php,修改里边的tplpath=>”pbdigg”为tplpath=>”douban”,也就是你的模板的文件夹名称。
3:在compile下建个douban文件夹
4:后台系统设置——功能设置——选择风格——douban,提交就可以啦。
若更新缓存或者发表文章出现类似:

Warning: articledigs (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articledigs]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 403

Warning: articledigs (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articledigs]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 403

Warning: articledigs() [function.include]: Failed opening ‘/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 403

Warning: articleviews (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articleviews]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 433

Warning: articleviews (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articleviews]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 433

Warning: articleviews() [function.include]: Failed opening ‘/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 433

Warning: articlecomments (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articlecomments]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 463

Warning: articlecomments (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articlecomments]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 463

Warning: articlecomments() [function.include]: Failed opening ‘/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 463

Warning: articlepostdate (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articlepostdate]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 493

Warning: articlepostdate (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articlepostdate]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 493

Warning: articlepostdate() [function.include]: Failed opening ‘/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 493

Warning: articlepic (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articlepic]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 523

Warning: articlepic (/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php) [function.articlepic]: failed to open stream: No such file or directory in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 523

Warning: articlepic() [function.include]: Failed opening ‘/home/clin003/domains/woaikan.clin003.com/public_html/data/cache/cache_templates.php’ for inclusion (include_path=’.:/usr/local/lib/php’) in /home/clin003/domains/woaikan.clin003.com/public_html/include/Cache.class.php on line 523
提示信息
发表成功,现在转入主题页。


警告信息:可以到后台——模板管理——打开文章模板然后提交就可以啦。

另外由于这个模板调用啦用户名,而post页面没有这个变量,需要在post.php页面找到PBOutPut(‘post.html’);在前边添加一行$TPL->assign(‘customer’, $customer);
你可以根据自己需要修改header.html中的欢迎语句,还有footer.html中的版权,不过建议保留模板作者版权,谢谢珍惜俺们的劳动成果。

pbdigg支持 , , ,

修修改改补补

February 25th, 2008

修修改改补补(wordpress sidebar widget改造和Tags函数,archives函数,categories函数调用)

为啦这个blog空间(wordpress)看起来简洁,用起来速度,脑子发热的时候就来考虑优化,布局空间。

第一件事:

去掉啦sidebar里边的存档widget,和标签云图widget,增加啦导航栏中的“存档” “标签云”导航栏 存档 标签云 链接截图 连个连接,觉得这样至少可以使本来就够臃肿的sidebar长度变简短些,少调用次数据库。

做法就是做一个存档页模板页面和一个标签云模板页面,(我是从page.php页面复制后然后修改)。具体代码可以参考:

按月存档:<?php wp_get_archives('type=monthly'); ?>
按分类存档:<?php wp_list_categories(); ?>

标签云页面模板只要知道<?php wp_tag_cloud(); ?>这个就可以啦,这个函数有很多参数具体可以参考:http://codex.wordpress.org/Template_Tags/wp_tag_cloud这里,下边给个完整的使用例子:wp_tag_cloud('smallest=8&largest=22&unit=pt&number=45
&format=flat&orderby=name&order=ASC’)

具体的参数所代表的意义与作用如下
smallest 最小字号,即用于关联日志最少的标签的字号,默认 8
largest 最大字号,即用于关联日志最多的标签的字号,默认 22
unit 字号单位,例如 pt、em、px 等,默认 pt
number 数量,即指定最多显示的标签个数,默认 45
format 格式,可选参数有“flat”平铺、“list”列表,默认平铺
orderby 排序方式,默认为“name”即按标签名排列,留空则按照关联日志数来排列
order 排序方向,默认为“ASC”即正序排列,可选参数“DESC”为倒序排列
exclude排除某个标签。每个标签都有一个ID,如果你希望哪一个标签不显示,那就用’exclude=5,27′。那相应的标签就不会显示。默认情况下是没有排除的。
include包括某个标签。跟 exclude相反。如果你用’include=5,27′,那就只显示这两个ID的标签。默认情况下是显示全部标签的。

列举三种定义显示tags效果的代码:
<?php the_tags('Article Tags>> ', ' | ' , ''); ?>
<?php the_tags('Tags<LI>', '<BR />' , '</LI>'); ?>
<?php the_tags('Tags<LI>', '<LI>' , '</LI>'); ?>

标签云的显示效果代码:
块状 <div><?php wp_tag_cloud(); ?></div>
列表 <?php wp_tag_cloud('format=list'); ?>

第二件事:

新建啦个sidebar,这样我就可以让不同的页面显示不同的sidebar widget内容,而不用受只有一个sidebar全部页面要么显示相同的sidebar widget内容要么就不显示 。

我是这样做的,首先去复制原来的sidebar.php为mysidebar.php,然后修改mysidebar.php里边的<?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?> <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>这样就相当于调用第二个sidebar,然后修改functions.php 文件找到下面的代码
<?php
if ( function_exists('register_sidebars') )
register_sidebars(1);
?>

修改为:
<?php
if ( function_exists('register_sidebars') )
register_sidebars(2);
?>

这就相当于注册啦两个sidebar。

然后到需要调用这”第二”个sidebar的话可以使用 <?php include_once("mysidebar.php"); ?> 加在<?php get_footer(); ?>前边或者你需要的地方,就可以啦,然后你需要做的就是去拖拉你的sidebar widget。

参考文章:

http://zeuscn.net/archives/2007/08/11/update-sidebar-widget/

http://www.sinzi.org/pub/2007/09/add-wordpress-23-tags-to-themes.html

wordpress支持, 今日一点 , , , , , ,