March, 2010Archive for

What is HipHop for PHP?

HipHop for PHP transforms PHP source code into highly optimized C++. It was developed by Facebook and released as open source in early 2010. HipHop transforms your PHP source code into highly optimized C++ and then compiles it with g++ to build binary files. You keep coding in simpler PHP, then HipHop executes your source code in a semantically equivalent manner and sacrifices some rarely used features - such as eval() - in exchange for improved performance. Facebook sees about a 50% reduc...

Tracking the user’s browsing history with PHP and cookie

Here is a sample code to show how using php and cookie to tracking the user's browsing history. The code is used on a shopping website. Hope it helpful to you. [code] /* browsing history */ if (!empty($_COOKIE['ECS']['history'])) { $history = explode(’,', $_COOKIE['ECS']['history']); array_unshift($history, $goods_id); $history = array_unique($history); while (count($history) > $_CFG['history_number']) { array_pop($history); } setcookie(’ECS[hi...

Border-radius: create rounded corners with CSS!

W3C has offered some new options for borders in CSS3, of which one is border-radius. Both Mozila/Firefox and Safari 3 have implemented this function, which allows you to create round corners on box-items. This is an example: Rounded corner example. The code for example above is simple: [code]<div style=" background-color: #ccc; -moz-border-radius: 5px; -webkit-border-radius: 5px; border: 1px solid #000; padding: 10px;" >[/code]

9 Excellent ToolTip Plugins with jQuery

1) clueTip clueTip goes one step further than (mb)tooltip, it has many advanced options that you can utilize such as having the tooltip move with the mouse cursor, forcing the tooltip to stay on the page until a user action closes it, a really nice “loader” graphic which appears between the point that the event is fired and the tooltip is loaded, and much more. The loader is actually very useful, especially when you are loading dynamic content into your tooltip via ajax for exampl...

How to use Gzip to load your site faster in 5 minutes

This tutorial will only examine one particular way of implementing Gzip compression with PHP, but there is another way to accomplish it with Apache if you have administration access to your server. Step 1: Enable zlib compression in php. You can do this many ways, just choose one: * Add a line to your .htaccess file: [code]php_flag zlib.output_compression On[/code] * Add or change a line in your php.ini file: [code] output_buffering = Off output_handler = zlib.output_compres...

Using Jquery to insert a row in parent window table

If we have a table in parent widow: [code] <table id="demo_table"> <tbody> <tr> <td>1</td> <td>a</td> </tr> </tbody> </table> [/code] Now, we want use jquery to insert a row to this table from a frame. We can write jquery: [code] parent.$('#demo_table').last().append('<tr><td>2</td><td>b</td></tr>'); [/code] or this way [code] parent.$('#demo_tabl...

How to write in jquery “window.parent.document.getElementById().innerHTML”

For example we want get this [code] window.parent.document.getElementById("myEle").innerHTML = html; [/code] In Jquery, we can write like this: [code] $("#myEle", window.parent.document).html(html); [/code] or we can also write in this way: [code] parent.$("#myEle").html(html); [/code]

How to Display Alexa Traffic Rank Statistics at Your Website

Following codes will display different statistics graphs / charts on your web page. Replace 'yoursite' with your 'domain name' to use these. [code] <!--Daily Traffic Rank Trend--> <script language="JavaScript" type="text/javascript" src="http://xsltcache.alexa.com/traffic_graph/js/g/b/6m?&amp;u=http%3A%2F%2Fwww.yoursite.com+++++"></script> <!--Daily Traffic Rank Trend--> <img src="http://traffic.alexa.com/graph?&amp;w...