Showing posts with label cakephp. Show all posts
Showing posts with label cakephp. Show all posts

Tuesday, 29 April 2014

News: Cakephp 1.3.18 and 2.4.8 released on April 29, 2014





Cakephp core team has announced the availability of Cakephp 1.3.18 and 2.4.8 on April 29, 2014. Cakephp Developers, who are struggling with security issues, now recommended to use SecurityComponent.


Lists of expected changes in 1.3.18 are given below:
  • Model conditions containing : or ? are now handled correctly. This fixes issues around using casting in conditions
  • SecurityComponent form tampering hashes now include the URL path as a hash input.

Lists of expected changes in 2.4.8 are given below:
  • SQLServer now properly appends the schema name when describing tables.
  • Hash::extract() can now match boolean attributes.
  • fclose() errors when using shells should no longer happen.
  • CakeResponse::file() now throws an exception when paths contain '..'.
  • ShellDispatcher now casts argv to an array. This fixes issues when cake console was invoked from a non-cli SAPI.
  • TextHelper::autoLink() now correctly links urls with subdomains containing '\_'.
  • SecurityComponent form tampering hashes now include the URL including the query string as a hash input.

Friday, 11 April 2014

Infographic: Comparison Between Cakephp And CodeIgniter!

PHP Frameworks (Cakephp and CodeIgniter) provide a firm structure for code. It also saves us from rewriting the same code and creating the functionalities all over again.

While CodeIgniter would be well-suited for smaller applications, CakePHP is an advanced framework-distributed under MIT license. Each framework has its own pros and cons, but it really depends on your project's complexity and provision to choose the suitable one.

So here is an Infographic that provides a brief comparison between Cakephp and CodeIgniter frameworks with their respective pros and cons:


Wednesday, 29 January 2014

4 Steps To Make Registration Form In Cakephp



Before starting to learn about how to make registration form in Cakephp, I want to make it clear that you should read abo MVC model in Cakephp.

Step 1 - Create Table and fields

In first step we create table in database then create fields that are generally included in registration forms (like username, password, email id etc.)

Database query to create table: Create table ‘tablename’
Database query to create field:
CREATE TABLE tablename (
ID INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(ID),
username VARCHAR (50) NOT Null,
password VARCHAR (50) NOT Null,
email VARCHAR (100) NOT Null,
firstname VARCHAR (25),
lastname VARCHAR (25),
)";
 

Note: - You can write any suitable name in place of “tablename”.

Step 2 - Create Model

Model is the part that takes care of the database logic. Create model with “tablename.php” in app/models as we defined name of table is “tablename” in first step. To make action on “tablename” we have to declare name (like name) because it uses in controller to save data. Code looks like: $this->name->save(data).

Code to create model: 
<?php
class tablename extends AppModel
{
var $name=' name ';
}
?>


Step 3 - Create View

View is the part that presents data received from model. Create view ‘register.ctp’ in app/view/tablename. We are creating form here in HTML although you can use helpers provided by cakephp to create form too.

Code to create view:
<html>
<form action="../tablename/register" method="post">
<p>Register your account.</p>
<label>Username:</label><input name="username" size="40" />
<label>Password:</label><input type="password" name="password" size="40"/>
<label>Email Id:</label><input name="email" size="40" maxlength="100" />
<label>First Name:</label><input name=" firstname " size="25" />
<label>Last Name:</label><input name=" lastname " size="25" />
<input type="submit" value="register" />
</form>
</html>


Note: Always remember the input name should be same as column name of our table.

Step 4 - Create Controller

Controller is a part that responds to user with combined action of model and view part. Create ‘tablename_controller.php‘ in app/controllers.

Code to create controller:
<?php
Class tablename_Controller extends AppController
{
function register(){
if (!empty($this->params['form']))
{
if($this->name->save($this->params['form']))
{
$this->flash('Registration Successful','/tablename/register’);
}
else
{
$this->flash('Not succeeded','/tablename/register');
}
}
}
}
?>


How above codes work?

First user open registration form here, "tablename/register/" in his browser. User fills the registration form details and click on register button. In controller it will check for the register function as we mentioned the action of form as ‘../register’ .

Register function in controller will save the data of form by using given statement
$this->name->save($this->params['form'])

This statement create insert query in database, i.e.
Insert INTO
Tablename(username, password, email, firstname, lastname)
Values
(‘mike’,’mike123’,’mike@gmail.com’,’mike’,’hussy’)


After insert command, a message pop-ups on your window “Registration successful” and you are done!

Resource: W3schools.com

Thursday, 28 November 2013

5 Do’s of CakePHP Web Development That A Developer Usually Bypasses

Image Courtesy: community.connectwise.com

Most developers are confident of being 100% familiarized with each part of CakePHP Website Development. Actually, developers are well known with the development process. But, many of them actually don’t aware from what they should need to do during project development process. This post explains five such things which every developer should remember at the time of development:

Web standards
Web standards are made to provide the quality, movability, availability and usability to your application. When we ignore these standards, it impacts the application process adversely. Your applications must be in compliance with these web standards or should be W3C validated. Therefore, follow the standards for all web programs so that you don't repent in future advantages.

URL Optimization
Search engine Optimization (SEO) is a crucial factor of the online accessibility of each website and URLs play a vital role in building a site SEO-friendly. While working, developers normally forget to optimize the URLs structure that suits for search engines. So, don’t leave the site URLs without optimization. Always optimize the URL structures of your CakePHP website by including all necessary keywords.

Organize Content
Website content is a significant part as it attracts several customers and it should be organized orderly on a site. So, don’t ignore the elements like titles, sub-titles, paragraphs, keywords and bullets to include as it impacts website traffic flow.  Also check the grammatical mistakes twice to make your content error prone. Assure that your placement of content should be at right place where it best suits and describes application functionality.

Application Testing
Don't leave your site before testing your application. It is important for CakePHP developers to understand that testing application is a part of their work regime. If they don’t test application, it may be possible that workflow of an app will corrupt, which impact adversely on your site performance. Therefore, test all necessary parameters including performance, quality, bug-issues, and security of application. Other solution is to hand over the task to a quality-assurance team in your company.

Test Coding
It is important to test the code once written as it helps to miss the last minute hassle. Most developers don't check codes before leaving the website. It puts them sometimes in trouble at important occasions. So, it is recommended to grasp the importance of checking and re-checking their code.

Thursday, 14 November 2013

Learn Cakephp from Tutorials



Cakephp is a fast growing framework that makes website development faster and easier for php programmers. Its MVC platform is a great help to developers. It’s already in-built view structure and functional library is making PHP popular among other programming languages.
For beginners, it is really a tedious task to find right assistance for learning Cakephp from the basics. So, here I collect some very good tutorials and sources to learn and understand Cakephp framework thoroughly.

Online Books and PDFs
The very first tutorial for every beginner should start with is the e-book suggested by cakephp.org itself. It is one of the best books to start learning basics of Cakephp. 

Gobookee is another good place to find several e-books (free or paid both) in Cakephp category. One best thing is that if you have any good tutorial to share then you can also submit it here.   

Video Tutorials
Video is the best tutorial to learn and apply Cakephp phenomenon itself. Official Cakephp channel is very popular among beginners as well as experts. Here all topics related to Cakephp development, issues and solutions discussed by qualified experts.

Andrew Spark is another known name that is very experienced and knowledgeable tutor. He explained Cakephp fundamentals and applications in his video series in a very simple and understandable manner.  

Cakephp Blogs
James Fairhurst explained all the Cakephp methods from installation to code snippets in his articles and tutorials. His famous series of tutorials is “Full cake 1.2 App (Part 1 to 12)”.

I highly recommend “Nuts and Bolts of Cakephp” blog to read and learn tips and tricks of Cakephp to practice at home. Also you can find new updates and code snippets for several issues like session storage, firebug logging etc.

Cakephp Cheat sheet
I always prefer to carry a cheatsheet to remind code snippets for particular function quickly. It saves time, makes process faster and people can find a lot of code snippets for Cakephp platform at one place. So, here is one of the best online cheat sheets to learn and use several coding actions and data definitions.

Forums and Q/A websites
If you don’t able to search and find the solution of your queries, you can ask from experts in different communities and Q&A websites. Just post your question and get your answer in no time. Forums and Q&A websites are best to even ask some silly questions which you can’t able to discuss with your friends and tutor. Simply first register an account on forum site and post a new thread with your queries. Here people are always available to help beginners and experienced too. Some popular sites are:

Monday, 28 October 2013

How Cakephp is Better than Other Plateforms for Web development?


Image courtsey: squaremelons.com

CakePHP can be best defined as an open source development framework for the new generation coders. Based on PHP scripting language & MVC architecture, CakePHP provides its users with extremely easy programming digest and friendly guide for development.

It is easy to create objective modules in CakePHP with its well-segregated building components. For a beginner like me it has been always easy to have the CakePHP built-in validation features – that allow you to comply with the major rules and conventions of PHP development, with dynamic trackback options. Taking care of your leads at every instance of development, Cake’s dynamic built-in support allows you to gain all the momentum needed in developing lengthy codes and controlling your tasks flawlessly.

Another noteworthy thing about the Cake framework is, it requires less coding and allows you to set-up database effortlessly. With Cake’s well-organized library, you get code assemblies to build different functionalities and object modules. Powered by easy instructions, these exclusive code events let you effortlessly command the attributes that you need in your application without having to look inside-out and wasting much of your time.

I have seen many of my friends shifting to this framework just because they wanted to have liberty of doing things excessively, at one place. 

Another important thing that makes CakePHP so desirable is its powerful scaffolding features that are highly instrumental in building prototypes rapidly. With CakePHP scaffolding features you can interactively create, retrieve, update and delete objects and define how objects are related to each other, most easily! CakePHP has been also different in the way it offers flexibility to its users. Flexible Caching and ACL (Access Control List) offers great benefits to its users by letting them interact with all those entities the way they want and retrieve the needed information most suitably.