September, 2011Archive for

ExtJS4 Viewport Example

This is an simple example to show you how to create a viewport in ExtJs4. The Viewport renders itself to the document body, and automatically sizes itself to the size of the browser viewport and manages window resizing. There may only be one Viewport created in a page. The Viewport does not provide scrolling, so child Panels within the Viewport should provide for scrolling if needed using the autoScroll config. Unlike the panel component of Ext JS, Viewport does not have a tbar option. ...

ExtJS4 : read posting JSON data in PHP

I am working on a Ext-JS web application which needs to send data to the PHP server side to store. It took me a while to find out how to decodes the receiving JSON string in PHP. Ext-JS Assume you have a model and calling save to send a ajax request. PHP If you use $_POST variable to pass the JSON string, you won’t see anything. It is just an empty array. This is because the Content-Type in the Request packet is different now, application/json. The JSON expression string in the...

ExtJS4: Add Custom Right Click Menu in MVC

The way to create a custom menu in mouse right click event function in ExtJS 4 is little different with pre-version. It seems in Ext 4.0.2 they changed event name and arguments order. First, let's see how we create the menu in Ext 3. I get this example from aditia rahman: Let's write a DataView to add a listener. When the data view is rendered it disabling the default right click web browser menu, this is called in listeners “render” event and “contexmenu” event is for detectin...

ThinkPHP中实现gzip压缩

ThinkPHP中似乎没有对gzip的配置选项。不过实现起来还是挺简单的。以下是对 ThinkPHP 2.1 的修改方法。 首先要确定空间是否支持Zlib, 然后找ThinkPHP的控制输出函数output()。 控制输出的文件在 ThinkPHP/Lib/Think/Core 文件夹下,文件名 View.class.php。

Using Global variables and arrays in Extjs 4

This example will show you how to declare a global var and arrays in Extjs MVC application. You know where to find this code : Global application variable : Simple, right? Now you can access this variable everywhere in your mvc application. If you need arrays , try this:

PHP断点续传 HTTP学习笔记

HTTP断点续传原理是这样的: 1. 客户端需要告诉服务器端从哪里开始。 2.服务端收到请求,返回206状态。并标识续传的起始点及结束点 如下实例 1. 客户端传递请求信息给web服务器,要求从200070字节开始。。 GET /down.zip HTTP/1.1 User-Agent:NetFox RANGE: bytes = 200070- Accept:text/html,image/gif,image/jpeg,*;q=.2,*/*;q=.2 2.服务端收到这个请求以后,返回信息 206 Content-Length = 100222222 Content-Range = bytes 200070 - 100222221/100222222 Content-Type=application/octet-stream 注意:服务端状态 206; Content-Range = bytes (客户端请求续传起始点) - (下载文件大小-1)/(下载文件大小) 在PHP中,是利用$_SERVER['HTTP-RANGE...