Codeigniter 3 new realease – PHP framework

There is no doubt that CodeIgniter is a powerful PHP framework. It comes with a small footprint, however it built for developers who need a powerful toolkit to create full-featured web applications. Codeigniter is a very easy to understand for php framerwork learner.

CODEIGNITER 3 VERSION RELEASEEllisLab planned to release CodeIgniter 3 under the Open Software License 3 (OSL3).
General Changes in new Codeigniter 3 will be :

  • PHP 5.1.6 is no longer supported. CodeIgniter now requires PHP 5.2.4 and recommends PHP 5.4+ or newer to be used.
  • Changed filenaming convention (class file names now must be Ucfirst and everything else in lowercase).
  • Changed the default database driver to ‘mysqli’ (the old ‘mysql’ driver is DEPRECATED).
  • $_SERVER['CI_ENV'] can now be set to control the ENVIRONMENT constant.
  • Added an optional backtrace to php-error template.
  • Added Android to the list of user agents.
  • Added Windows 7, Windows 8, Windows 8.1, Android, Blackberry, iOS and PlayStation 3 to the list of user platforms.
  • Added Fennec (Firefox for mobile) to the list of mobile user agents.
  • Ability to log certain error types, not all under a threshold.
  • Added support for pem, p10, p12, p7a, p7c, p7m, p7r, p7s, crt, crl, der, kdb, rsa, cer, sst, csr Certs to mimes.php.
  • Added support for pgp, gpg, zsh and cdr files to mimes.php.
  • Added support for 3gp, 3g2, mp4, wmv, f4v, vlc Video files to mimes.php.
  • Added support for m4a, aac, m4u, xspf, au, ac3, flac, ogg, wma Audio files to mimes.php.
  • Added support for kmz and kml (Google Earth) files to mimes.php.
  • Added support for ics Calendar files to mimes.php.
  • Added support for rar, jar and 7zip archives to mimes.php.
  • Updated support for xml (‘application/xml’) and xsl (‘application/xml’, ‘text/xsl’) files in mimes.php.
  • Updated support for doc files in mimes.php.
  • Updated support for docx files in mimes.php.
  • Updated support for php files in mimes.php.
  • Updated support for zip files in mimes.php.
  • Updated support for csv files in mimes.php.
  • Added Romanian, Greek, Vietnamese and Cyrilic characters in application/config/foreign_characters.php.
  • Changed logger to only chmod when file is first created.
  • Removed previously deprecated SHA1 Library.
  • Removed previously deprecated use of $autoload['core'] in application/config/autoload.php. Only entries in $autoload['libraries'] are auto-loaded now.
  • Removed previously deprecated EXT constant.
  • Updated all classes to be written in PHP 5 style, with visibility declarations and no var usage for properties.
  • Added an Exception handler.
  • Moved error templates to application/views/errors/ and made the path configurable via $config['error_views_path'].
  • Added support non-HTML error templates for CLI applications.
  • Moved the Log class to application/core/
  • Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment.
  • Changed detection of $view_folder so that if it’s not found in the current path, it will now also be searched for under the application folder.
  • Path constants BASEPATH, APPPATH and VIEWPATH are now (internally) defined as absolute paths.
  • Updated email validation methods to use filter_var() instead of PCRE.
  • Changed environment defaults to report all errors in development and only fatal ones in testing, production but only display them in development.
  • Updated ip_address database field lengths from 16 to 45 for supporting IPv6 address on Trackback Library and Captcha Helper.
  • Removed cheatsheets and quick_reference PDFs from the documentation.
  • Added availability checks where usage of dangerous functions like eval() and exec() is required.
  • Added support for changing the file extension of log files using $config['log_file_extension'].
  • Added support for turning newline standardization on/off via $config['standardize_newlines'] and set it to FALSE by default.
  • Added configuration setting $config['composer_autoload'] to enable loading of a Composer auto-loader.
  • Removed the automatic conversion of ‘programmatic characters’ to HTML entities from the URI Library.
  • Changed log messages that say a class or file was loaded to “info” level instead of “debug”, so that they don’t pollute log files when $config['log_threshold'] is set to 2 (debug).

For more detail please visit at http://www.codeigniter.com/userguide3/changelog.html

Should i build my own CSS Framework or need to create my own customized one ?

We do not need to create custom CSS grid, framework or whatever you like to call it. There are already so many professional frameworks are availabe. We dont need to waste time on those which is already available in marketing with remove all those bugs which may occur in our custom css framework.

How ever there are advantages and disadvantages to use third party css framework. Before use it, think that is it required to use it for small task or not. Suppose your site is simple and you can create your website in responsive with few links of code, then i suggest dont use css framework, because generally css framworks have large files. In this case, instead of get benefit from css framework, it may overload on your page even if it is simple. So before use it you just think yourself. I am not telling that css framework is bad. It is already good to use it, but it depends on situation and your website design layout. In market there are so many css framework like  Twitter Bootstrap Grid module, Zurb Fundation, 960.gs, The 1140px Grid, and more.

I suggest to create you own css framework and use it if possible in your small scale website design. You website will load very very fast if your css will be in small size. You can measure it when you will use both css framework and your custom css. Finally, its your own choise what you want to use.

how to use and save php array in cookie using serialize and unserialize

Hello friends,

As an php developer , many times you may need to store php array in cookies. Am i right ?

If you are creating any shopping cart, then you may have requirement to store billing and shipping address in cookies.  To minimize code we like to store billling and shipping address in array. But you may have face problem about how to store php array in cookies. I had also felt same problem. After spend some times, i have founded a very easy steps. Perhaps you may like it.  Many of you had already tried serialize and unserialize php array  in cookies, but may be failure to get perfect results.

How to store php array in cookies :

$phparray=array(“name”=>”alex”,”phone”=>”123456789″);
setcookie(‘mycookiename’, serialize($array) ); 

Just convert php array into serialize as above to store in cookie

To get back php array from cookie, just use given below code

$data = $_COOKIE[‘mycookiename’];
$data= html_entity_decode($data);    // Important
$myarray= unserialize($data);

Output of $myarray and $phparray will be same. You dont require jsonencode or decode. 

Is it not easy solutions ? !!

 

 

How to create shadow using pure css property

Hello Friends,

Now html5 and css3 are more important in web design. There are some browser where it does not fully support html5 and css3 like internet explorer. However microsoft trying to support fully html5 and css3 tags like firefox and chrome.   At present i am not comparing any browser, because our aim to  create shadow in div box using pure css property. So now lets see our main goal.

Following is a simple css scripts.

div
{
box-shadow: 10px 10px 5px #888888;
}

This will add shadow in each div box.   but suppose you want to shadow in any specific div then you can do as under

<style>#mydiv { box-shadow: 10px 10px 5px #888888; }</style>

<div id=”mydiv”> this is content of div </div>
supports

Primary syntax :

box-shadow: h-shadow v-shadow blur spread color inset;

The box-shadow property attaches one or more drop-shadows to the box. The property is a comma-separated list of shadows, each specified by 2-4 length values, an optional color, and an optional inset keyword.  The box-shadow property allows designers to easily implement multiple drop shadows (outer or inner) on box elements, specifying values for color, size, blur and offset.

With many other ‘experimental’ CSS3 properties, you’ll need to use the following prefixes to support Mozilla and Webkit:

#example1 {
-moz-box-shadow: 10px 10px 5px #888;
-webkit-box-shadow: 10px 10px 5px #888;
box-shadow: 10px 10px 5px #888;
}

Understanding shadow property with dia gram :

shadow css property

Live example :

#testdiv{

    box-shadow: 0 0 5px 5px #888888;
    float: left;
    height: 65px;
    padding:7px;

text-align: center;

    width: 160px;
    display :block;

background-color: #EEEEEE;
}

 

 

this is test this is test this is test

Responsive CSS Framework By Gumby

Are you a web designer and planning to start or create responsive web design ? If yes, then i would like to refer you a Gumby Framework.  This css framework as following features

1) Fluid-Fixed layout self-optimizes for desktop and mobile resolutions.
2) Gumby Framework defaults to a 960 footprint. Designers and coders rejoice
3) Engineered to be there when you need it, and get out of your way when you don’t.
4) Gumby Framework includes multiple types of grids with different column variations which enables you to be flexible throughout an entire project’s lifecycle. From concept to deployment, Gumby Framework follows your lead.
icon_codebaseGumby Framework includes several types of networks with different variations of that column to be flexible throughout the entire life cycle of a project. From concept to implementation, Gumby Marco follows suit.

For more detail you can visit http://gumbyframework.com/

Version : Gumby 2

 

Fixed div box while scrolling window using javascript and css

fixed div while scrolling windows

fixed div  while scrolling windows

Have you used fixed div scroll ?

I think many of you have shown div box which at time of load page, it scrolls when we scroll window, but later on after reach at some specified pixed, div box remains at fixed position. Am i right ?

Such type of windows are very useful in case of advertisement or highlight some contents. However mostly it is used for google ads in blogs. So now i am showing that how you can do it ? Its a very easy simple, you just need to download my sample files. I have used pure javascript and css property for it. There is not any extra file load. I have used  google jquery CDN libray, about which you all are aware.

Javascript code :

<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js”></script>
<script>
$(function () {

var msie6 = $.browser == ‘msie’ && $.browser.version < 7;

if (!msie6) {
var top = $(‘#comment’).offset().top – parseFloat($(‘#comment’).css(‘margin-top’).replace(/auto/, 0));

$(window).scroll(function (event) {
// what the y position of the scroll is
var y = $(this).scrollTop();

// whether that’s below the form
if (y >= top) {
// if so, ad the fixed class
$(‘#comment’).addClass(‘fixed’);
} else {
// otherwise remove it
$(‘#comment’).removeClass(‘fixed’);
}
});
}
});
</script>

You can see that code of fixed div scroll is very simple.  At time of initial it detects given div offset and then changed top position as fixed when it reaches at specified pixel. As per given example when top position will touch our given div box then , its css property will change to fixed. In this way while scrolling windows, our div box will be fixed on top.

View DEMO

Download File

 

 

Lengths in CSS Property

CSS Length Measurement

As an developer, you may have query regarding which types of length i should use in css property. Am i right ? There are a few CSS properties by taking a length as value. Box model properties are most evident: width, height, margin, padding, border. But many others as well: the offset and the size of a box-shadow or the size and spacing of fonts.  Lets see one bye one with an example. This will help to understand easily.

px  (Absolute length)

.wrap {
width: 400px;
}

Pixels are always a canonical measure on the web but they are constantly manipulated, many other lengths correspond directly to the pixels, and JavaScript speaks pixels. Pixels are perhaps best considered “device pixels” that this length has nothing to do with the screen pixels literal screen you are watching. It is actually a measure angle. It is supposed to be a value that is standardized across devices and screens, but is increasingly no longer true.

cm

.wrap {
width: 20cm;
}

centimeters are more familiar and useful as a physical measurement.  We can map to pixels like this 1cm == 37.8px

in

.wrap {
width: 4in;
}

‘in’ map directly to pixels.This are not used widely

mm

.wrap {
width: 100cm;
}

And an order of magnitude smaller== 37.8px

Em  (Font-Relative Lengths)

.wrap {
width: 40em;
}

A relative unit. Although the length doesn’t change when you change font-family, it does change when you change the font-size.

% (Percentage)

.wrap {
width: 50%;
}

A length set in percentage is based on the length of same property of the parent element. This is widely used. As specially in responsive design this property helps more.

There are also more length options. About which we will discuss on next articles.  However if you need to see more then just visit

Let me know if you have any query.

 

Zendframework 2 : how to define global custom functions easily

Hello Friends,

As we know that zendframework 2 is not very easy to learn or understand.  Its true that its 100% pure OOPS. But for beginner it may create problem to understand it. It is not easy compare to ZF1 (Zendframework 1) initially. Zendframework 1 work was easy to understand, but now in zendframework2 it is completely different acrchitecture.  Now load speed is minimized in zendframework 2. But problem for beginner is to implement code.  I am also learning zendframework 2 and founded that it sometimes take more time to code. I

Custom functions

Suppose if you want to use your own custom functions then it is required to updated module.php and other files.    But i have an other short cut using which you can use your own functions very easily. And also you will not required to write anything in module.php, controller or module file. Even you dont need to use namespace or  dont need to use php function ‘Use’ .

Steps to create custom functions in zendframework 2

Step-1 : Just create one file say myfunctions.global.php in  autoload directly. and write your function in normal way

Step -2: At last in this file, you just need to write blank array like following.

Example :

myfunctions.global.php

function plus($v1,$v2)
{

return $v1+$v2;

}

return array();      // dont forget to write this

That’s it.

Now you just use function name in your model, controller or module in simple way like you were used in core coding. I know that perhaps this is not write way. But to do some task, i think this is very short cut.

Am i right ?

 

 

 

 

which php framework is best

PHP FRAMEWORK

Hello Friends,

There are so many php developers that are working on core coding and want to shift or want to try php framwork. But problem is that which framework is best for php and how to choose it ?. I am also php web developer and i also faced same problem. I just give you my opinion and experience of php framework.

First of all , i would like to tell that i like my core coding because i can do what i want. In php framework you need to understand all things which are developed by framwork developer. No doubt, that if you work on php framework then your code will be in proper way. Because we have to follow its rules, class , model or function. You can use any php framework. Generally all php framwork are based on MVC (Model View Controller).

I have tried CODEIGNITOR, YII , CACKEPHP and ZEND FRAMEWORK2.   I think if you want easy php framework then you should go for codignitor, yii or cackephp. While zend framework2 seems some complex compare to others. However zendframework1 was easy. But i would recommend to go for zend framework2 because it will suppose mobile application too.  Zend framework 2 based on event manager. Initially you will feel hard but later on it will easy. At present i am still learning it but it becomes complex for me because i am lover of core coding and so.    I have also developed my own MVC, which seems very useful and also think to develop it to use in my coming project.  I have developed this MVC after review opencart shopping cart. I was so impress about its internal data flow and database structure.

So in general way you can follow any php framework which you like. In market there are following best php framework.

  1. CodeIgnitor
  2. CakePHP 
  3. Yii 
  4. CodeIgniter 
  5. Zend Framework-2 
  6. Symfony

 

 

jquery ui datepicker

Jquery is one of the easiest way to implement datepicker for form’s input field. You can also set on focus event to fire date popup. Choose a date, click elsewhere on the page (blur the input), or hit the Esc key to close. If a date is chosen, feedback is shown as the input’s value.

jquery date picker

Simple Source Code :

<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>
How to restrict or disable date in jquery date picker ?
jquery disable date range
Restrict date range: (Source code)
<html lang="en">
<head>
<meta charset="utf-8" />
<title>jQuery UI Datepicker - Restrict date range</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.3.js"></script>
<script src="http://code.jquery.com/ui/1.10.0/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
$(function() {
$( "#datepicker" ).datepicker({ minDate: -20, maxDate: "+1M +10D" });
});
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker" /></p>
</body>
</html>
Do you want get more tutorial, then just visit source