If the visitor is from USA, the visitor’s computer language is en-us, or en; if the visitor is from France, the language is fr; if this visitor is from China, the language is zh-cn…
Sometimes we do not want our vbulletin forum show certain content to some visitors from certain counries, say if the visitor is from China, we do not show adsense, otherwise, adsense is displayed. How to do then?
Here let me tell you the code:
<vb:if condition=”substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2) != ‘zh'”>
<script type=”text/javascript”><!–
google_ad_client = “ca-pub-xxxxxxxxxxxxxxxxxxxxxxxxx”;
/* contacts */
google_ad_slot = “xxxxxxxxxxxxxxxxxxxxxx”;
google_ad_width = 728;
google_ad_height = 90;
//–>
</script>
<script type=”text/javascript”
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
</script>
</vb:if>
In general, the code is like this:
<vb:if condition=”substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2) != ‘zh'”>
text shows if the visitor is from China
<vb:else />
test shows to visitors not from China
</vb:if>