<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/" -->
<rss version="0.92">
<channel>
	<title>飞龙博客</title>
	<link>http://feilong.org</link>
	<description>犹如天之色，内藏龙之湾。有朋自网上来，不亦乐乎？</description>
	<lastBuildDate>Sat, 12 May 2012 15:11:31 +0000</lastBuildDate>
	<docs>http://backend.userland.com/rss092</docs>
	<language>en</language>
	
	<item>
		<title>插入相册或图片lightbox特效演示</title>
		<description>这是插入相册或图片的lightbox特效的演示。

一、，将相册插入某篇日志正文的任何地方，需要在 gallery 加 link="file"

举例：显示 日志id是507，的相册，如下写代码。如果没指定日志id,则默认显示当前日志相册。一般不要在代码内指定尺寸，当然了，也可以指定尺寸。

[gallery id="507" link="file"]

[gallery id="507" link="file" size="medium"]

参考资料：
http://feilong.org/lightbox-plus-wordpress-plugin
http://codex.wordpress.org/Gallery_Shortcode
 

二、初始插入图片链接

需要在 a链接 加 rel="lightbox[id or name]"，一般用name ，name最好是字母，不用汉字。
这是2个有关系的图片链接

举例：



三、初始插入文字链接

也需要在 a链接 加 rel="lightbox[id or name]"，一般用name ，name最好是字母，不用汉字
这是2个有关系的文字链接

第一张图
第二张图	


四、只有一个图片

这里插入img标签或文字，方法参见上面的二、三。
										

五、本质上说， rel="lightbox[sheying]" 这个代码，用lightbox 标识激活了特效，用 具有相同name来把多个图片关联起来。图片的name相同，则啊通一个特效之内。感谢：Color Powered、飞龙、 lightbox-plus

2012年4月13日 </description>
		<link>http://feilong.org/lightbox-plus-wordpress-plugin</link>
			</item>
	<item>
		<title>用php禁止某个IP段访问网站</title>
		<description>用php禁止某个IP段访问网站的代码。


 </description>
		<link>http://feilong.org/ban-ip-to-site</link>
			</item>
	<item>
		<title>表格table标题内容一行显示多的用省略号</title>
		<description>表格table内容文章标题超长一行显示多的用省略号，css解决方案


#catgoodlist table{table-layout:fixed;}
#catgoodlist table th#biaoti{/*width:100px; background:#f90;*/}
#catgoodlist table td{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;-o-text-overflow:ellipsis;}
 </description>
		<link>http://feilong.org/table-css-ellipsis</link>
			</item>
	<item>
		<title>飞龙分离式选项卡jQuery版通用精简版</title>
		<description>分离式选项卡： 选项卡的标题和正文不在一起。缺点：语义不足。优点，不需定位，内容可以自适应高度。这是通用的tab选项卡做法，飞龙分离式选项卡jQuery版通用精简版。可以多次运用，一次jQuery代码，多处实例灵活运用。本日志修订网址：http://feilong.org/jquery-gap-tabs-ul

一、tab选项卡css样式，包括基础样式[gaptabs basic css ] 和实例样式[gaptabs application sample1 css]。

/* gaptabs basic css */
ul,li,ol{margin:0;padding:0;list-style-type:none;}
.gaptabs{}
.gaptabs .tabtits{}
.gaptabs .tabtits li{float:left;}
.gaptabs .tabtits li a{}
.gaptabs .tabtits li a span{}
.gaptabs .tabtits li.nowtit{}
.gaptabs .tabcont{clear:both;display:none;}
.gaptabs .nowcont{display:block;}

/* gaptabs application sample1 css */
#bangdan{background:#fff; margin:6px;}
#bangdan .tabtits{display:block;background:#fff; }
#bangdan .tabtits li{ display:block;height:24px; line-height:24px; margin:0 5px; padding:0 5px; background:#eee; text-align:center;}
#bangdan .tabtits li a{ text-decoration:none; letter-spacing:2px;}
#bangdan ...</description>
		<link>http://feilong.org/jquery-gap-tabs-ul</link>
			</item>
	<item>
		<title>WordPress调用前后b篇文章并让当前文章居中的数学模型</title>
		<description>调用前后b篇文章并让当前文章标题居中数学模型，飞龙采用例证法推断。这个适合调用前后n篇文章并让当前文章居中显示，当然也适合分类，比如调用前后n个分类，让当前分类居中的计算。飞龙给客户定制的WordPress主题中就用到了这个前后日志或分类调用的问题。本日志修订地址：http://feilong.org/current-post-between-previous-next-b 2012年于广州。



$b=3;//前后3篇为例，即每页只显示7篇 $perpage=$b*2+1;
$count=22;//不分页情况下的查询日志/分类 总数 可以先查询 $posts or $cats 再count
//$here;当前文章在不分页情况下所处的 位置 当前页所示的当前分类id或日志id，循环总查询获取$here的值

//$here  $offset

//1 0
//2 0
//3 0
//4 0
if($here$b+1) && ($here=$count-$b){$offset=$count-$b-$b-1;}

//echo '$offset='.$offset;//每页排除数
$perpage=2*$b+1;// 每页实际查询数
//可以查询了


 </description>
		<link>http://feilong.org/current-post-between-previous-next-wordpress</link>
			</item>
	<item>
		<title>全选反选飞龙jQuery解决方案</title>
		<description>记得用JavaScript写的全选反选飞龙jQuery解决方案吗？今晚飞龙用jQuery试试checkbox列表的全选反选解决方案。本日志修订网址：http://feilong.org/check-uncheck-juery-solution 2012年于广州


//全选反选飞龙jQuery解决方案
$(function(){

//反选方案
function fl_checkbox(formid,submitclassname){
$('#'+formid+' .checkrevert').click(function(){
$('#'+formid+' input[type=checkbox]').each(function(i){//1
if(this.checked){
$(this).removeAttr('checked');//alert('checked');
//$(this).prop("checked", false);for jQuery 1.6+
}else{
$(this).attr('checked', 'checked');//alert('no')
//$(this).prop("checked", true);//for jQuery 1.6+
}
});
});//1

//全选方案
$('#'+formid+' .checkall').click(function(){
$('#'+formid+' input[type=checkbox]').attr('checked', 'checked');
});//1

//某表单提交
$('.'+submitclassname).click(function(){
var checkedlength=$('#'+formid+' input[type=checkbox]:checked').length;//alert(checkedlength);
if(checkedlength){return true;
//$('#'+formid).submit(function(){return true;});	
}else{alert('至少选一项');return false;// so it won't submit		
} 
});//1


}///function over

//applications
fl_checkbox('goodorder','ordersubmit');
fl_checkbox('catbuy','buysubmit');



});//0




/**以下只是参考资料**/
//var checked=$('input[name=foo]').attr('checked');alert(checked);
//var checked=$("#list input[type='checkbox']:checked"); //alert(checked.length);
//var checked=$('#list input:checkbox:checked');alert(checked.length);
//var ischecked=$(this).is(':checked'); //alert(ischecked);
var firstchecked=$('#list input:checkbox:checked').first();alert(firstchecked.val());
var checked=$("#list input:checked[name='jiluids[]']");alert(checked.length);

//http://feilong.org/check-uncheck-juery-solution

//var nochecked=$("input[type='checkbox']").not(':checked');alert(nochecked.length);
//var disabled=$("input[disabled='disabled']");//alert(haschecked.length);

var checked=$(this).attr('checked');
if(checked){
alert(checked);$('input[name=foo]').attr('checked', true);
}else{
alert(checked);	$('input[name=foo]').attr('checked', false);
//$('input[name=foo]').removeAttr('checked')
if($('input[name=' + newData + ']').is(":checked")){}
}//feilong.org

//$('#inboxx input').attr('checked', true);
//$('#inboxx input[type=checkbox]').attr('checked', ...</description>
		<link>http://feilong.org/check-uncheck-juery-solution</link>
			</item>
	<item>
		<title>翻页分页数学模型智力题</title>
		<description>今天准备己开发一个分页翻页的php函数，不想直接采用他人的代码，自己先研究一下，方便以后自由自定义。先自己拟定了如下的翻页分页数学模型智力题，自己出题，自己解答。

已知最大页数maxpage=27，将他们分为若干个区间，每个区间rang=7，求最后一个区间会有多少个数字？一共有多少个区间？

飞龙解答：

1、先例证法：

1234567
891011121314
15161718192021
222324252627

2、再考虑数学模型如下：

设最后一行有m个数字，设一共可以分为n个区间。根据例证法得知，
最后区间的计算公式是： 7(n-1)+1 到 7(n-1)+m   或   7n-7+1 到 7n-7+m
其它每个区间的计算公式是：7(n-1)+1 到 7n


最后一行的开头和结束，组成二元一次方程如下：
27=7n-7+m，
22=7n-7+1

第一个方程减去第二个方程，得出：m-1=5
即：m=6

将m值代入任意一个方程，得出：7n=28
即：n=4

3、有没有更抽象不需要例证法支持的解答？

设一共n个区间，则7n是可能的最大值，也就是 7n>=27 得出 n>=27/7 即 n>=4
7n-6是可能的 最后行第一个值，也就 7n-6 </description>
		<link>http://feilong.org/page-navi-maths</link>
			</item>
	<item>
		<title>第一个同级元素 css伪类的写法举例</title>
		<description>第一个同级元素，第一个同胞，老大，css伪类的写法

一、css写法。

/*提示：first-child指的是li，不是ul*/
li:first-child{color:#f00;}

/*提示：first-child指的是ul*/
ul#feilong:first-child{border:1px solid #060;}




这是li第一
这是li第二
这是li第三



这也算li第一，还是 ul#feilong的第一



这也算li第一,但是不是ul#feilong的第一或第二

 </description>
		<link>http://feilong.org/css-first-child</link>
			</item>
	<item>
		<title>服务器不支持session怎么办</title>
		<description>在使用php和session存储数据的时候，本地xampp服务器能使用session，但ftp上传到远程虚拟主机服务器，飞龙发现竟然没有存储session。莫非服务器不支持session 还是php代码本日志更新网址：http://feilong.org/session-php-webserver-no 加入收藏夹，查看更方便。

我们下了解一下session的机制：Session数据保存在服务器端, 但是每一个客户端都需要保存一个SessionID, SessionID保存在Cookies中, 关闭浏览器时过期.在向服务器发送的HTTP请求中会包含SessionID, 服务器端根据SessionID获取获取此用户的Session信息。

飞龙用session的和php编写的存储程序参见： http://feilong.org/ajax-session-click-add-remove-favorate 本地服务器是win7+xampp集成环境，运行session结果显示正常存储了session数据。

然后放到上linux Apache mysql的虚拟主机上，用session的程序以后虽然提示成功，但是session数据在接受页并没显示，说明session数据并没有存储。

网上查了一些答案：session_start()的前面有echo之类的语句，包括html空行？如果服务器不支持session,先要开启？session 也要用到cookie，您看下您的cookie是否已禁用？本机不报错，因为你本机的php配置去掉了错误显示？

一般来说，不让header(); 之前有echo或html，这个是个很细致的检查工作，有没有办法避免呢，也就是如何使用session_start();  才能让让header(); 之前有echo或html，也不会出错呢？

session的输入缓冲机制为我们解决了这个问题。


ob_start();

// some html
// echo 'feilong before';

//anything

@session_start();
//header(......);

// some html
// echo 'feilong after';

//some html
//anything

ob_flush();


经过测试，飞龙发现远程主机也可以运行session并成功存储数据了，并不是服务器不支持session的原因。
 </description>
		<link>http://feilong.org/session-php-webserver-no</link>
			</item>
	<item>
		<title>php点击加入或取消收藏ajax接受数据session存储</title>
		<description>点击某个图片或文本链接或任何DOM元素，将某日志文章加入收藏或取消收藏，可以采用ajax实现，然后在接受数据页用session存储该文章ID号。如何用Ajax与session结合，实现加入或取消收藏的功能？飞龙自己捣鼓了以下的代码。本日志修订网址：http://feilong.org/ajax-session-click-add-remove-favorate

一、首先在点击互动页，一般是某文章页。
飞龙的WordPress是某个single日志页，需要实现点击链接切换收藏或取消收藏的效果。同时需要向目标数据接受页传递日志ID号。

1、根据本文章是否已经收藏，调出对应的链接图片或文本：


 </description>
		<link>http://feilong.org/ajax-session-click-add-remove-favorate</link>
			</item>
</channel>
</rss>

