Creating zip file archives in php

In this post we are talking about to creating zip file in PHP. It’s very simple to create zip file, similar to creating in desktop. There is one more logic behind to creating zip file, if you want give some stuff for download to your users, then you have to upload completely zip file in your server then provide the download link over it.

But with the use of this function you just have to give the files that you want to store in zip and the name of the zip file that you want to create, yes you will create a single zip file with the collection of files. As you see in the below codes i have created a simple form and with the use of check-box i have given the choice for the files that you want to add in the zip file, and then all the rest work depending on the PHP.

Read More

Get focused element in jquery

Mainly jQuery .focus() event is used to get focused element, but what if we have a chain of elements in a single .focus() event? In this post i simple describe that how do we get focused element with jquery in a chain of elements with the use of .focus() event. As you see below highlighted codes i show you both the jquery section and the html section, First i want to describe the html section, in the HTML section in also mentioned the ID of the the input element, all the ID’s are different according to the input element.

Read More

Short a string without cutting words

I develop this function to short the string without cutting the words. As we now that PHP’s substr() function only provide the part of the string, substr() function provide the string between the two parameters, start from and end to.

So I need a function that provide the string arround the given starting from and end to range. Below given function provide the arround complete word from the string. This function check the nearest space into the string and provide the nearest word without cutting. If you guys have a better alternative then please feel free to share the codes in the comment section.

Read More

Countdown timer in javascript

Here i introduce with the simple countdown timer script written in JavaScript. My main purpose behind this countdown timer script is just logout the user if he/she is idle. In this example i set the idle time 15 minutes, means the user will automatically logout if he/she do not active on the page. To achieve this i used window.setInterval() javascript function, which is call my own defined function after every 1 second. As you see in the below example i have created a function getIdleTime(), this function calculate every minute and second and display to the user, as you see i called an id with document.getElementById(), just call the id where you want to show your countdown timer.

Read More

Speed Up your website with htaccess caching

If we are talking about SEO, then google has been announced that the speed of your web page also matter to improving your page rank and website performance. In this post we are talking about that how to improve the website loading performance so that the speed of loading the webpage also increase, and if you want to check the increased speed of your webpage the there is a page speed add-on available for Firefox, which is automatically integrated in firebug.

All this can happen with a single “.htaccess” file, which means htpertext access(htaccess). htaccess is just a simple but most powerful ASCII file. You can create this file with any editor.

Read More

Fade In / Fade Out with CSS Transition

It is easy to make fade in / fade out effect with pure CSS, means no need to any JavaScript or jQuery. But this fade in/out effect only working in latest browsers only, here is the list of the supported WebKit browsers:

Browsers list:

  1. Chrome 1.0
  2. Firefox(Gecko) 4.0(2)
  3. Internet Explorer 10
  4. Opera 10.5
  5. Safari (WebKit) 3.2

To make it all browser compatible you have to use jQuery or JavaScript, in jQuery it is simple with the fadein() and fadeout() function. There are few transition property that we are using in this fade in / out effect.

Read More