Yu Xiankang Youyou asked me last night how to implement this welcome word on my blog.
In fact, a major string of Google is code.
But to gather an article, send it out.
Add the above code to the topic's functions. php.
The code is as follows: |
Copy code |
Function show_refer_in (){ $ Refer_info = $ _ SERVER ['http _ referer']; $ Ban_list = array ($ _ SERVER ["HTTP_HOST"]); For ($ ii = 0; $ ii <count ($ ban_list); $ ii ++ ){ If (strpos ($ refer_info, $ ban_list [$ ii]) { Return; } } If ($ refer_info ){ Preg_match ("/^ (http ://)? ([^/] +)/I ", $ Refer_info, $ matches ); $ Host = $ matches [2]; Echo "<div id =" hellobaby "> Welcome to friends from". $ host! <Br/> we recommend that you <B> <a href = "http://www.111cn.net" target = "_ blank"> click here </a> </B> subscribe to my blog o (& cap; _ & cap;) o <div class = "closebox"> <a href = "javascript: void (0)" onclick = "inline ('display', 'none '); "title =" close "> × </a> </div> "; } } |
Then, call the function in footer. php.
The code is as follows: |
Copy code |
<? Php show_refer_in ();?>
|
Of course, it can also be added to the header, but it will not be worth the candle if the speed of opening is affected.
With the output, we must add css.
Here is the css code used by a blog.
CSS
The code is as follows: |
Copy code |
# Hellobaby {background: #000000; border: 1px solid # B3B3B3; color: # FFFFFF; font-size: 14px; opacity: 0.7; filter: alpha (opacity = 70 ); padding: 10px; position: absolute; right: 0; top: 250px ;} # Hellobaby { Background: #000000; Border: 1px solid # B3B3B3; Color: # FFFFFF; Font-size: 14px; Opacity: 0.7; Filter: alpha (opacity = 70 ); Padding: 10px; Position: absolute; Right: 0; Top: 250px; } |