Posts

Recursive in CakePHP

Image
Today we are going to learn about Recursive in CakePHP . Using this recursive property, Cake will know about the depth of the result that needs to be generated when find() and read() methods are used.It is needed to set the depth of the retrieval of records associated with a model data so we can limit how much data is fetched from the query in case of multi levels of associations between your models. Lets say for example we have Author module which has many Books.Now you have such case in which you want to retrive the data of the authors plus their books too.So in this case how Recursive play its role? We have Model file for Author having the following code. <?php class Author extends AppModel {    var $name = 'Author'; } ?> and Model for the Book, <?php class Book extends AppModel {    var $name = 'Book'; } ?> Now write the index function in AuthorsController.php file   public function index()    {       $authors = $thi...

10+ android based project ideas for programmers or final year students

Many of us interested to develop mobile based application instead desktop based application. You think that you will develop mobile based application especially for android for your final semester project or for fun. But you can't  even think what you should do or should not do. What types of project you can take as you are beginner or don’t know about it. May be searching internet you will not get huge information on this topics. In this discussion I will try to provide you 10+ android based project ideas by which at least you can understand the trends of android project. I will start with some fundamental android project idea and then I will try to provide you some advance project idea that will help you to be a professional android application developer.    In android developer site you can get 20+ sample projects . These projects are one of the best resources for learning android application development. You can take a look on these projects before reading it. So now...

Top 5 E-Commerce Themes For Drupal

Image
Drupal is a stable and robust e-commerce platform that is extensively used to run shopping portals. Coupled with the fact that Drupal is also open source and easily available, it is one of the most used platforms along with WordPress, Joomla and Magento. You can easily get extensive range of e-commerce themes for Drupal and make the most of them for your business. 1. BigShop : Developed by TabVN, BigShop is a responsive Drupal theme that can be used to run a sturdy and attractive e-commerce platform. BigShop uses Drupal Commerce module along with API payment method add-to-wishlist, Tax calculation support, product rating etc. 2. Spotlight : The theme is compatible with the latest Drupal version 7. Developers can use the theme to design portrait or landscape designs mainly for the mobile version using the Spotlight theme. 3. Retail Shop :  To add freshness and clarity to designs, Retail Shop is a good theme for Drupal e-commerce. Created by ThemeSnap, Retail Shop supports importa...

SVC handlers missing in IIS on Windows8

Image
A quick tip. I recently upgraded OS to windows 8 and installed both VS2010 and VS2012. Post that, my svc files stopped working in IIS and threw a 404 not found error. After a little struggle I found that .svc mappings were missing in IIS and the easy way to restore them is: 1. Open Control Panel 2. Select "Turn windows features on or off" 3. Expand.NET framework and check HttpActivation for WCF and you're done!

Dynamic Fields Validation in CakePHP

Image
In this post we'll learn about dynamic fields validation .Generally validation is achieved by placing the validation rules in the model file.You can get the idea of how validation rules are written in model file by the example given below. <!-- file:app/models/yourmodel.php --> var $validate = array( 'name' => array( 'notempty' => array( 'rule' => array('notempty'), 'message' => 'This field is required..!', //'allowEmpty' => false, //'required' => false, //'last' => false, //'on' => 'create', ), ), 'SRRP' => array( 'numeric' => array( 'rule' => array('numeric'), 'message' => 'This field is required..!', //'on' => 'create', ), ) ); But here,the fields (Example: name,SRRP) are static fields.Following lines of code were written in view ...

CRUD in CakePHP Part : 2

Image
In previous post we learnt about view and listing of the Users.In this post we'll learn about add,edit and delete operations. Adding Users To add a user record put the below function in our UsersController.php public function add() {         if ($this->request->is('post')) {             $this->User->create();             if ($this->User->save($this->request->data)) {                 $this->Session->setFlash(__('User has been saved.'));                 $this->redirect(array('action' => 'index'));             } else {                 $this->Session->setFlash(__('Unable to add User.'));             }         }     } Here we have to include the SessionComponent ...

CRUD in CakePHP Part : 1

Image
In this post we will see how to create simple CRUD application in CakePHP. Creating the Users Database Let’s set up the database for our blog.Right now, we’ll create a single table for our users. We will  add few records of users in order to test. Simply run the SQL query given below into your DB: /* Create our users table: */ CREATE TABLE users (     id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,     firstname VARCHAR(50),     lastname VARCHAR(50),     email VARCHAR(50),     message TEXT ); /* Then insert some users for testing: */ INSERT INTO users (firstname,lastname,email,message)     VALUES ('Ricky', 'Astley', 'test1@test.com','Hello...!'); INSERT INTO users (firstname,lastname,email,message)     VALUES ('John', 'clinton','test2@test.com','How are You...!' ); INSERT INTO users (firstname,lastname,email,message)     VALUES ('Smith', 'Johnson', 'test3@test.com','I am Fine...!'); Create a Us...