ITTreats.com
Enter your Search term and Hit "Enter"

Thu, 11 Mar 2010 9:37:46 AM +00:00

Latest 'ITTreats'


Populating Check All Checkboxes Functionality using Javascript & JQuery

Populating Check All Checkboxes  Functionality using Javascript & JQuery

At time are you stuck with doing Check All functionality for your Application?

Here is How you can do it in quick manner. This Tutorial will guide you How to Achieve Check All Checkboxes by checking a single Check box.

Here is an Example Instance. In the following Page I want to check All the Check Boxes Once If Check the Top most Checkbox at the Header section.

More . . .

Simple Logging in PHP

Simple Logging  in PHP

What if  we get a simple  code which logs for us about  about  activity. which logs  your  message  as well as  the User IP Address, User Agent  as well as  Referrer…

Fantastic  isn’t it .  So,  Here it  is

This  Class is   a  Abstract  Class  so,  you need not worry about even  instantiating the class for Logging your message each and every time,

By simply  placing this  file into your Application and  customize  the settings you require   and  choosing  On  what timely basis  you need to create your new Log files  for  Once  and  then  GO !!

Log  Class  has  Constants  parameters  as follows

// LOG  DIRECTORY   PATH   by DEfault  it  takes the  Folder  from where it is  executing Please use  Tailored Slash
	const   LOG_DIR= "logs/";
 
	//   PREFIX  FOR  AUTO CREATED  LOG FILE   CHANGE  THIS IF YOU Wish to do
	const  LOG_PRE="Log";
	//   Default Extenstion
	const  LOG_EXT=".txt";
	//   DISABLE  WRITING  LOGS  IN  LOCAL  ENVIRONMENT
	const  LOG_DISABLE=false;
 
	//  LOGG  IPADDRESS
	const LOG_IP=true;
 
	// LOGG  HTTP  REFERRER
	const LOG_REF=true;
 
	// LOGG  USER AGENT
	const LOG_UA=true;

More . . .

Only Domain Name from URL using Regular Expression

Only Domain Name from URL using Regular Expression

Dear Friends, as PHP 5.3.x is released and you will be aware of the truth that ereg() regular expression functions are deprecated from the latest versions i.e no more usage of ereg()

So,  keep this  in mind not to use of  ereg()  from today onwards :)    This  effects  most of the  popular  CMS   i,e  Drupal,  Joomla So,  before you upgrade your  PHP version on your server,  know  the  facts  about  weather  your Application   supports  PHP Latest  versions  or not.

Coming to the  Point , Some times  while tracking  user information   we may need to  grab  the  User Domain  name  part  through coding part.  Here  is  simple  function   which  makes your  life  simpler .

/*  function  to  return only  Domain Name  from the URL  variable
 *  This  function takes  one parameter i.e  URL  variable  and returns  the domain name
  *
/*
function onlyDomain($url)
{
preg_match('@^(?:http://)?([^/]+)@i',$url, $matches);
$host = $matches[1];
 
// get last two segments of host name
preg_match('/[^.]+\.[^.]+$/', $host, $matches);
return $matches[0];
}
 
/*  end of the function

Hope this function will help

How to Insert Flash File into Header of Your Wordpress?

How to Insert Flash File into Header of Your Wordpress?

Most of weblog owners are keen  to insert  Flash file into Header of the blog or wordpress website.

Here is the simplest tutorial  to replace your  Header Image file  into  Flash File in your wordpress website or blog.

1. Take a sample page of your wordpress blog or website  by  browsing into any one of the page,   Take the source of the page  and  copy it and  name it as  sample.php in your working directory.

More . . .

Easy Tutorial for Learning Code Igniter

Easy Tutorial for Learning Code Igniter

CodeIgniter is a very powerful yet very simple PHP Framework to learn and Implement. CodeIgniter is  simple and elegant toolkit to create full-featured web applications. CodeIgniter is very fast growing and widely used Open Source PHP Framework  which is used to develop best  web based applicationscodeigniterusing PHP.  I bet  you  Love to implement this Framework for you small  medium  as well as  big  very  big  applications.

CodeIgniter is  Best Solution If you are looking at  following Factors :-

1. Looking for Simpler Framework

2. Looking for Zero Configurable Framework

3. Looking for Framework  with best Documentation

Then  what are you waiting for, start installing  today and implement  your application  right from tomorrow.  It is that much easy to work with CodeIgniter.

More . . .

workaround for sessions on cookie disabled machines in php

workaround for sessions on cookie disabled machines in php

In PHP, Will sessions work on cookies disabled  Computers ?

The answer is   “NO”.

because,

Server cookie is a session or we can say that session is also a cookie on the server.

For session to work, cookies on server as well as on client browser should be enabled.

More . . .

Trimming Completely using PHP Regular expressions

Trimming  Completely using PHP Regular expressions

Hello Friends,

Is your  Trimming method  is taking care for  special characters ?  you might be using  some trimming for some of the special characters but what about the rest ? for you  here is a  simple  Function which will trim  the string  entirely  and  results only the pure string

function pureTrim($input)
{
        // This allows Only   Alphabets Numerals  and Space
	$output = preg_replace("/[^a-z0-9\s]/i", " ", $input);
	$output= trim($output);
	return $output;
 
}

So, try using this function your code . Hope this will help you

Calculate Page Execution time in PHP

Calculate Page Execution time in PHP

For those people who want to give users that in how many seconds actually your web page loaded completely. This script will be useful for you. There are so many ways to do this ( As usual ) but the classic approach would be

Step 1 : make a note of  the time when your page get starts

Step 2: make a note of  the time  at the end of your total page execution

Step 3 : step 2 – step1, You will get your page execution time

In simple   Here is the function  which will do it for you .

You have  to   call the function at the  start  and   echo  it  at the  end.   simple !!!!

More . . .

Text Area Values into Array in PHP

Text Area Values into  Array in PHP

If you  want  to split up  the total text area content  into  array  based on the  row ,  Here is simple solution  to convert  textarea  field  value into  array in PHP.

$total=$_POST["textarea"]
 
$keyarr=explode("\n",$total);
// In order to  process this  array  values  here is the code 
 
foreach($keyarr  as  $key=>$value)
{
   //  becareful to check the value for  empty line 
   $value=trim($value);
   if  (!empty($value))
   {
        // Carry out your  own operations 
   }
}

Make a Sortable table According to the column data on each column

Make a Sortable table According to the column data on each column

If we are making an reporting interface, it will be very very useful if we can provide sortable table on each column. If  the sort  happens  with a simple click on column names with out any  server requests ??  Yes,  it is perfect .

sort

More . . .