Finally, I’ve fixed the problem of language recognition.
Before, my site can not filter the posts very well in a language which is determined by the browser’s language setting to show on the homepage.
When I use the code :
<?php if ($_SERVER["HTTP_ACCEPT_LANGUAGE"] != “zh-CN”) {query_posts(’cat=57,16′);} ?>
in homepage, the posts can be filtered correctly in IE7: If your browser’s language setting is zh-CN, the homepage will show all the posts, else, the homepage will show all the posts in category ID 57/16.
But in IE6 or FireFox, it doesn’t work. Because the browser’s language setting is “zh-cn”, it’s not “zh-CN”.
So I added a condition :
<?php
$lan=&$_SERVER["HTTP_ACCEPT_LANGUAGE"];
if (($lan != “zh-CN”)&&($lan != “zh-cn”)) {query_posts(’cat=57,16′);}
?>
Maybe it is not very “beautiful”, but it works very well for me! So hope it can help you! Maybe one day, I can make it smarter!
Ps: The codition part is a general format in PHP code, but the execute part is only for Wordpress!
div+css实现圆角边框,代码如下:
<html>
<head>
<style>
#a{
border-left:1px #333 solid;
border-right:1px #333 solid;
width:300px;
height:500px;
}
.b{
height:1px;
overflow:hidden;
border-left:1px #333 solid;
border-right:1px #333 solid;
}
</style>
</head>
<body>
<div>
<div class=”b” style=”margin-left:3px;width:294px;background:#333″></div>
<div class=”b” style=”margin-left:2px;width:296px;”></div>
<div class=”b” style=”margin-left:1px;width:298px”></div>
<div id=”a”>
我能做到的,纯DIV+CSS实现的效果,只能这样了。这里是放置内容的地方,观察一下代码的规律,很容易明白。
代码很简单,a层为放置内容的层,其width值为300,然后向外以2像素的宽度递减。最外一层要加上background为个属性,目的是要将上、下两线条呈现出来。
这里实现了3像素的圆角边框,b层的数量决定了要实现多少个像素边框。建议不要多于3层,最好是2层,即2像素圆角边框,或者1层,因为层数越多,圆角的表现就越不圆滑。在firefox IE6 都通过测试。
</div>
<div class=”b” style=”margin-left:1px;width:298px”></div>
<div class=”b” style=”margin-left:2px;width:296px;”></div>
<div class=”b” style=”margin-left:3px;width:294px;background:#333″></div>
</div>
</body>
</html>
- * 0 Comments *
- Tags: Code, CSS, Div
See this post in : English Version or Chinese Version
Private Sub Command1_Click()
r = InputBox(”Entrez un chiffre pour vérifier, SVP”)
For i = 2 To r
If Val(r) Mod i = 0 And i <> Val(r) Then ‘Ici donne une condition pour les non premiers nombres
MsgBox (”Ce n’est pas un premier nombre”)
Exit Sub
End If
Next i
MsgBox (”C’est un premier nombre”)
End Sub
- * 0 Comments *
- Tags: Code, premier nombre, VB
See this post in: Chinese Version or French Version
Private Sub Command1_Click()
r = InputBox(”Enter a number please”) ‘ Enter a number to verify
For i = 2 To r
If Val(r) Mod i = 0 And i <> Val(r) Then ‘ this phase give a condition which is not a prime number
MsgBox (”The numbered you entered is not a prime number”)
Exit Sub
End If
Next i
MsgBox (”The numbered you entered is not a prime number”)
End Sub
- * 0 Comments *
- Tags: Code, prime number, VB
我因为人在法国,所以写日志时常要用3种语言交替:
中文是为了和大家共享一下我在法国的留学生活啦,还有就是以我的外文水平写不出来的东西…
英文是为了写博客赚钱啦,顺便能提高一下英语水平,学金融这是必备工具啊;
法文啊,这是我在这边的生活工具嘛…
好了,废话不多说,以下的code是我刚刚学来的,还没有深入研究:
进入你wordpress管理界面,然后进入主题编辑器,打开主页面模板,在
<?php if (have_posts()) :?>
和
<?php while (have_posts()) : the_post();:?>
之间插入如下代码:
<?php if ($_SERVER["HTTP_ACCEPT_LANGUAGE"]=”zh-cn”) :?> –识别浏览器的语言是否为 zh-cn
<?php else :?>
<?php if (is_home()) {query_posts(’category_name=en’);}?> –若不是 zh-cn, 在首页只显示” en “种类的日志
<?php endif ;?>
如果你不知道其他语言的代码是什么,进入IE的internet选项,在常规标签的最下方有一个语言按钮,单击它会打开一个新的小窗口,让你进行语言首选项的设置,你会看到有一个添加(A)…的按钮,点击它就能在新打开的小窗口中看到所有语言以及其代码。
希望这些能帮到你!!
- * 0 Comments *
- Tags: Code, 浏览器语言



