Blogroll

Tuesday, December 27, 2011

How to speed up your website ?

Minimize HTTP Requests

tag: content
80% of the end-user response time is spent on the front-end. Most of this time is tied up in downloading all the components in the page: images, stylesheets, scripts, Flash, etc. Reducing the number of components in turn reduces the number of HTTP requests required to render the page. This is the key to faster pages.
Friday, December 23, 2011

Detect load image when change image source

It's useful when you change image source such as photo slider, when you click thumbnail image, you can show the larger image.

Tuesday, December 20, 2011

Create multi background by css3

CSS3 allows web designers to specify multiple background images for box elements, using nothing more than a simple comma-separated list.
Tuesday, December 13, 2011

Detect ajax and render other view in zend

$request = $this->getRequest();
if ($request->isXmlHttpRequest()){
                  $this->_helper->layout()->disableLayout();
                    $this->_helper->viewRenderer('evencalendarajax');
                    //this->_helper->getHelper('viewRenderer')->setNoRender();
                }
1. get all request
 2. check request is ajax request.
3.Disable layout
4. Call another view if you want.
5. Disable view if you don't use view.
Thursday, November 17, 2011

Create custom router url

to create friendly url to must using custom router . This code is really useful for mvc framework like zend, codeignitor,.. This is the code:
Tuesday, November 8, 2011

Write breadcrums function

This function is really simple.

Show Related Post in WordPress Without a Plugin

Related posts is a very popular feature. My default wordpress installation often includes a plugin that has this functionality. There are quite a few plugins that lets you have this feature

Monday, November 7, 2011

Import data from excel file to database

Follow this link to show full guide.
link

news scroller with p tag( simple code)

Jquery is powerful tool to animate for website display, have plugin support news scroller, hovever almost is very heavy and does't support scroll with p tag. To day, I guide the way to create news scroller.
Friday, November 4, 2011

Use cache class

in previous post, i introduced the technical to cache a objec to file
And in this post, i continue introduce to way to use it.
The fist : thinking the id for cache, this id must be unique, example I have class person and do the list method  in this class at page 2 in default module.

Cache object in php to file

Cache is the technology to improve your website speed. To day i will introduce you how to cache the object in you php application. Note: You should't abuse cache, only use it in common object with the same result .
Saturday, October 29, 2011

Detect ajax request php

I have one script use for both ajax and normal request.
This code can help you detect ajax request to coding.

if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
  /* special ajax here */
 
}
Friday, October 14, 2011

Auto refresh page with header meta

Meta refresh is a legacy method of instructing a web browser to automatically refresh the current web page or frame after a given time interval, using an HTML meta element with the http-equiv parameter set to "refresh" and a content parameter giving the time interval in seconds. It is also possible to instruct the browser to fetch a different URL when the page is refreshed, by including the alternative URL in thecontent parameter. By setting the refresh time interval to zero (or a very low value), this allows meta refresh to be used as a method of URL redirection.
Wednesday, October 12, 2011

Embbed pdf for your website without flash

Today, i found the way to embbed pdf  in my webiste and i found many solution.
But the best way use google reader.

Monday, October 10, 2011

Save buffer output in Php

We all know that PHP is default sending all output to the standard output buffer( the browser in many cases if I can say like that.) That depends off course about your server configurations but that’s how it gets setup into the standard. There is a buffer size set in php.ini; when the output buffer is full, it is automatically flushed and sent to the browser. Many times in our programming life we wanted to change this standard way and send the contents to a variable instead of printing to the browser .
Thursday, October 6, 2011

Create unique Id sercure with hash

have many algorithm to generate to unique Id but almost is popular and the result only containt number
This function allow you to unique Id containt leter and number.
More it provide hash to sercure your unique Id.

Dropdown for IE6

Almost modern browser support dropdown menu easy only with css code.
But IE6 not support hover CSS. So this solution will be solved.

Download safe file without error

When you use header function to download to client. Sometime happend error because file is interupt. It cause by many reason: browser, your function and here is the code to solved this problem.
Tuesday, October 4, 2011

Cắt bỏ tiếng việt trong php

Việc cắt bỏ tiếng việt thực sự cần thiết khi chúng ta tìm kiếm thứ gì đó.
Sau đây là đoạn code để thực hiện điều đó.

Hàm chuyển chuỗi có dấu (Unicode) thành không dấu


Bài này mình viết hàm chuyển một chuỗi ký tự có dấu (Unicode), chuyển thành chuỗi không dấu