How many times have you struggled with URL validations? I have struggled a lot. Damn, those stupid regex(s). Well regex as a tech is not stupid, it’s awesome. but when u have a 10,000 regex expressions to choose from? and on the top of that every regex gives different result.
When I faced this challenge, I tested more than 80+ regex expressions, obviously not in a day :P. Then had to settle with a regex which had a least probability of producing -ve results.
Obviously as a programmer, I wanted better alternative. And I stumbled upon PHP filters. Well, it can be used for other things than validation as well such as sanitization, etc.
Why I would like to use filter_var instead of my or anybody else’s regex. Simply because, regex used in filter_Var are well tested and produce far less -ves. Moreover, being a native function, it produces results faster.
As far as my Codeigniter Application is concerned, I have extended the Validation library:
Core is a slow-moving branch that will be used as the base for EllisLab commercial products such as ExpressionEngine and MojoMotor. It will continue at a similar pace that CodeIgniter has in the past and will be useful for large commercial applications that require the upmost in stability and backward/forward compatibility at a pace more typical of SLA backed Enterprise products. Core is publicly available with tagged downloads at BitBucket.
Reactor is a community driven branch of CodeIgniter that will enable faster adoption of the best community submitted code to the framework. This means the community can create a fork of the project on BitBucket and contribute bug fixes, new features, documentation improvements, etc and have it reviewed by a code-review team called Reactor Engineers. These Engineers are primarily responsible for driving the development of the framework.
In simple words, Reactor will be managed by community + Ellislab and Core will be managed solely by Ellislab.
Some interesting things I liked,
Support for PHP 4.x is gone
Application Folder now sits outside System folder
CLI support (I am still trying to figure it out)
Full Query String support
memcache and APC support
Also, Ellislab has changed the file structure a lot. Check out change log to know more.
In all, new version seems interesting. Though moving 1.7.x apps to 2.x is not easy. Since, Plugins have been deprecated, you will need to convert plugins either into libraries or helpers. Also, some of the libraries may not work with 2.x.
The only thing that is making me doubtful is why CI has been split up into 2 branches? Is Ellislab trying to make money by creating an Enterprise version? I hope they don’t.
many of you must be using CodeIgniter for development of web apps. And I know everyone of you must have faced the problem of asset management (css, JS, images) in Codeigntier. Well here’s a quick tip for it and making it hassle free.
use of base tag in head section
First of all place all your files in some folder, this is how I use it. I always create three folders viz. css, images and js in root folder of codeigniter app. Then add following in head section
<base href=”<?php echo base_url(); ?>” />
After this, u can use only partial links in all you linking relative to you base href’s property!
and thats all, You won’t have to include base_url all the time in your codes for linking. It can be used for everything like images, scripts, css files etc.
We all programmers always try to find ways to do work more quickly and efficiently. Ask any programmer and he’ll say that “I have to write code again and again for so many things! I hate it!”. I am not talking about using for loops and functions here. I am talking about database connectivity, cross platform compatibility. I am talking about Frameworks!
In this post, I will try to emphasize on the benefits and usefulness of using development framework and how to update your development stack to next level. In short, this post is meant for those LAMP developers who still are using core PHP/CSS and HTML for development.
Frameworks for LAMP has been around for some time now and have evolved a lot. According to wikipedia
A software framework, in computer programming, is an abstraction in which common code providing generic functionality can be selectively overridden or specialized by user code providing specific functionality. Frameworks are a special case of software libraries in that they are reusable abstractions of code wrapped in a well-defined API, yet they contain some key distinguishing features that separate them from normal libraries.
There are a lot of php frameworks to choose from, But I suggest CodeIgniter to beginners.
Why is it best? because it’s really easy to install and learn. Requires minimal configuration and it’s ready to use in 3 minutes. It supports all major databases. All you have to do is call it’s API and it’ll automagically generate SQL queries according to database used. It’s also supports XSS filtering, also has form validation class etc. etc.
It’s also extensible. You can create your own library classes and extend it’s core. There is an extensive documentation which covers each and every aspect of codeigntier.
I can list you more than 10 useful CSS Frameworks, but the one that’s very popular and my personal favorite is: BluePrintCSS.
CSS framework allows you to quickly create websites. This one in particular offers you a grid, typography, forms and even a print css. It’s cross browser compatible so you don’t have to worry about cross browser compatibility. All you have to do to use it is to include screen.css and that’s it. And obviously you’ll have to learn it’s classes though 😉