Free PHP, HTML, CSS, JavaScript editor (IDE) – Codelobster PHP Edition

February 5, 2012 · Leave a Comment
Filed under: CakePHP, CodeIgniter, IDE Tools, Joomla, PHP, PRADO, Symfony, Zend 



For valuable work on creation of sites you need a good comfortable editor necessarily. There are many requiring paid products for this purpose, but we would like to select free of charge very functional and at the same time of simple in the use editor – Codelobster PHP Edition .

Free PHP, HTML, CSS, JavaScript editor (IDE) - Codelobster PHP Edition

    Let us consider some important possibilities and advantages of this program:

  • All code highlights depending on a type, the also mixed code is thus supported, so the area of HTML will be highlighted as HTML, PHP as PHP, and Javascript as Javascript in a the same file. Thre is possibility of choice from color schemes, including popular IDEs.
  • Powerful autocompletion for HTML, PHP, CSS and Javascript, including HTML5 and CSS3. For PHP the structure of project is fully recognized, and the complete list of methods falls out in the proper places.
  • HTML/CSS inspector on the type of Firebug, which allows easily to correlate the selected elements of page with a code and proper style.
  • Context help on all supported languages. By pressing F1 key the page with detailed description for current tag, attribute or function will be opened.
  • PHP debugger. PHP debugger allows to execute PHP scripts incrementally, watching the values of all variables in every line.
  • SQL manager allows to produce all necessary actions with a database – to add, delete, edit a structure and records in tables, to export data, execute SQL queries. Highlighting and autocompletion works for SQL files also.
  • Support of FTP allows to work straight with a remote server and to do all necessary changes with files;
  • The portable option allows to use editor without the preliminary installation.
  • Other useful utilities: pair highlighting, possibility of blocks selection, collapsing, tooltips, navigation on descriptions of functions and included files at withholding of the key of CTRL, viewing of structure of files and project, preview in a browser, book-marks, and all other standard possibilities for work with a code

Also there are special plugins for work with

  • CMS: Drupal, Joomla
  • PHP frameworks: CakePHP, CodeIgniter, Symfony, Yii
  • JavaScript libraly: JQuery
  • WordPress blogging engine
  • Smarty template engine
Developer: Codelobster Software
Language: English, Russian, German, Spanish, French, Portuguese
Supported: OS Windows 2000, Windows XP, Windows Vista, Windows 7
Download link:

Download Free CodeIgniter PDF Books

March 7, 2010 · Leave a Comment
Filed under: CodeIgniter, Featured, php framework 

If you are using Codeigniter for developing PHP applications you noticed the ìindex.phpî part of the URL of your application.

CodeIgniter (CI) is a powerful open-source PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. CodeIgniter is an MVC framework, similar in some ways to the Rails framework for Ruby, and is designed to enable, not overwhelm.

This book explains how to work with CodeIgniter in a clear logical way. It is not a detailed guide to the syntax of CodeIgniter, but makes an ideal complement to the existing online CodeIgniter user guide, helping you grasp the bigger picture and bringing together many ideas to get your application development started as smoothly as possible.

  • Clear, structured tutorial on working with CodeIgniter
  • Careful explanation of the basic concepts of CodeIgniter and its MVC architecture
  • Using CodeIgniter with databases, HTML forms, files, images, sessions, and email
  • Building a dynamic website quickly and easily using CodeIgniter’s prepared code

Buy From Amazon


Code Igniter Framework Overview

More Information download from here http://openpdf.com/ebook/codeigniter-pdf.html

Finally, the good folks at EllisLab released CodeIgniter. After working with and experimenting with all the available. PHP MVC frameworks, CodeIgniter has come … Install and configure CodeIgniter. The first step in any new CodeIgniter project is to download the latest package (1.6.2 as of this writing; see the … it�the rest of the system folder contains CodeIgniter core code, libraries, and other files you shouldn’t mess with. …

File name: 2008_Getting_Started_with_CodeIgniter.pdf
Search: getting started codeigniter

If you are using Codeigniter for developing PHP applications you noticed the �index.php� part of the URL of your application. You can remove it by doing two simple things: 1. Edit the config.php from .system/application/config/ and change the $config[‘index_page’] like this: $config[‘index_page …

File name: how-to-remove-indexphp-from-your-codeigniter-application-url.pdf
Search: remove index codeigniter application

arbitrary commands that can bypass stronger CodeIgniter Security class even if. $config[‘global_xss_filtering’] = TRUE;. Thus we can execute XSS on …

File name: CodeIgniter%20Global%20XSS%20Filtering%20Bypass%20Vulnerability.pdf
Search: codeigniter global filtering bypass vulnerability
Download CodeIgniter PHP Framework

CodeIgniter PHP Framework

CodeIgniter PHP. Framework. Toby Beresford. toby@tobyberesford.com. Page 2. Content. � Bio. � Benefits. � Why Frameworks. � MVC. � Demo. � Links. Page 3. Toby Bio … Download from. www.codeigniter.com. Page 9. Upload to your server. Page 10. See the welcome screen. Page 11. Create your database. Page 12. Configure CodeIgniter Base. URL. Page 13. Configure Database. Connection. Page 14. Create a controller. Page 15. Add the view. Page 16 …

Full CodeIgniter Textmate Bundle – Nettuts+

January 26, 2010 · Leave a Comment
Filed under: CakePHP, Featured 

his is a complete CodeIgniter TextMate/E-Texteditor bundle. It includes shortcuts for every CodeIgniter helper function, and library included in CodeIgniter 1.7.2. Tab stops and default values are provided.

Example


Nettuts+ – http://net.tutsplus.com/

Free Tutorial On Codeigniter Free Full Download Free Tutorial On

December 2, 2009 · 1 Comment
Filed under: CodeIgniter, Featured 

Free Tutorial On Codeigniter download, Free Tutorial On Codeigniter crack, Free Tutorial On Codeigniter serial, Free Tutorial On Codeigniter keygen,

http://www.rapidsharemegaupload.com/free-tutorial-on-codeigniter-crack-serial-keygen-free-download.htm

Creating Social Networking site with CodeIgniter The registration

December 2, 2009 · 1 Comment
Filed under: CodeIgniter, Featured, PHP 

This is the tutorial of creating the registration form for our social networking site, so lets start coding.

The Database:

create a new database called mysocial because our site name gone to be this.

Next for the creation of registration we are need of only one database and that is “USER” database

the user database contains 11 fields here is a pic of that

user_structure

The Dependencies:

For the creation of the registration we are depend upon some of the core libraries and helper class of the CodeIgniter Framework and they are:

Libraries: database,session,form_validation

Helper: url,cookie

The Model functions:

public function getMonthString()
 {
 $months = array();
 $months[1] = "Jan";
 $months[2] = "Feb";
 $months[3] = "Mar";
 $months[4] = "Apr";
 $months[5] = "May";
 $months[6] = "Jun";
 $months[7] = "Jul";
 $months[8] = "Aug";
 $months[9] = "Sep";
 $months[10] = "Oct";
 $months[11] = "Nov";
 $months[12] = "Dec";

 return $months;
 }

public function getDays()
 {
 $days = array();
 for($i=1; $i<=31; $i++)
 {
 $days[] = $i;
 }
 return $days;
 }

public function getYears()
 {
 $years = array();
 for($i=date('Y',time()); $i>=1900; $i--)
 {
 $years[] = $i;
 }
 return $years;
 }

public function check_email($email)
 {
 $this->db->select('id')->from('user')->where("email = '$email'")->limit(1);
 $q = $this->db->get();
 if($q->num_rows() > 0)
 {
 return true;
 }
 else
 {
 return false;
 }
 }

private function randString($length, $charset='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789')
 {
 $str = '';
 $count = strlen($charset);
 while ($length--) {
 $str .= $charset[mt_rand(0, $count-1)];
 }
 return $str;
 }

public function signup($fname,$email,$password,$sex,$month,$day,$year)
 {
 $key = $this->randString(20);
 $message = 'Welcome to the mysocial site click on the following link to activate your account';
 $message .= "<a href='".site_url('activate/'.$key)."'>".site_url('activate/'.$key)."</a>";
 if($this->db->insert('user',array('fname'=>$fname,'email'=>$email,'password'=>md5($password),'sex'=>$sex,'birthday'=>mktime(0,0,0,$month,$day,$year),'registered'=>time(),'key'=>$key)))
 {
 mail($email,'Registraton Confirmation',$message);
 return true;
 }
 else
 {
 return false;
 }
 }
 }

The getMonthString() function returns an array containing months  this function is used in registration for date of birth.

The getDays() function returns an array containing days from 1 to 31 this used for date of birth.

The getYears() function returns an array containing years from 1900-till year(2009) this is also used for date of birth.

next, the check_email() checks whether this email is already registered it takes email as its argument  if registered it returns true and if not it returns false this function is used in form validation process.

the randString() generates the confirmation link that is sent to user when he has finished the registration process it takes two argument the the first argument is the length of the confirmation link and next the characterset.

and at last the signup($fname,$email,$password,$sex,$month,$day,$year) register the user in our database

it takes seven parameters the fullname of the user,the email,the password,the sex,the month,the day and the year

if the user is registered successfully it send a confirmation links to the user’s email and returns true else it will return false.

Thats all the model functions needed for the registration process now lets move on to the controller functions

The Index Controller Functions:

First create a new controller named as “index” and add the following function to it.

Class Index extends Controller
{

 public function __Construct(){
 parent::Controller();
 }

 public function Index()
 {
 $this->common->index_login();
 $month = $this->common->getMonthString();
 $day = $this->common->getDays();
 $year = $this->common->getYears();
 $data = array('months'=>$month,'days'=>$day,'years'=>$year);
 $this->load->view('index_view',$data);
 }
 }

we first create a construct function an called the parent construct function next we created an Index function and pass the model functions to the view file.

NOTE: i’ve used the word common for the model file because my model file name is common.

The Index View:

the css:

*{margin: 0px;padding: 0px;}
.infoWrapper{margin-top:6px;clear:both;margin-bottom: 12px}
.infoTitle{float:left;width:90px;color:#808080}
.infoContent{padding-left:110px}
#footer{clear: both;}
#header{border: 1px solid silver;height:100px;background: #3B5998}
#l_pan{float: left;height:270px;width:500px;padding: 6px 3px;margin-left: 35px;}
.logo{float: left}
.login_div{float: right;margin-top: 25px;margin-right: 30px}
select{padding: 2px;}
body{background: #DEE3F0;font-family:"lucida grande",tahoma,verdana,arial,sans-serif;font-size:11px}
input[type="text"],input[type="password"]{padding:1px;}
label{color:#DEE3F0;font-weight: bold}
a{color:#DEE3F0;text-decoration: none;}
a:hover{text-decoration: underline;}
h1{color:#DEE3F0;margin-top:35px;margin-left:27px}

The HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
 <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
 <meta name="author" content="mubarak" />
 <title>mySocial</title>
</head>
<body>
<div id="wrapper">
 <div id="header">
 <div><h1>mySocial</h1></div>
 </div>
 <div id="l_pan">
 <div>
 <form action="<?=site_url('signup')?>" method="post">
 <div>
 <div>Full Name:</div>
 <div>
 <input type="text" size="35" name="reg_fname" id="reg_fname" />
 </div>
 </div>
 <div>
 <div>Email:</div>
 <div>
 <input type="text" size="35" name="reg_email" id="reg_email" />
 </div>
 </div>
 <div>
 <div>Password:</div>
 <div>
 <input type="password" size="35" name="reg_passwd" id="reg_passwd" />
 </div>
 </div>
 <div>
 <div>Sex:</div>
 <div>
 <select name="reg_sex">
 <option value="">Select Sex:</option>
 <option value="1">Male</option>
 <option value="2">Female</option>
 </select>
 </div>
 </div>
 <div>
 <div>Birthday:</div>
 <div>
 <select name="reg_month">
 <option value="">Month:</option>
 <?php
 foreach($months as $k=>$m)
 {
 echo '<option value="'.$k.'">'.$m.'</option>';
 }
 ?>
 </select>&nbsp;
 <select name="reg_day">
 <option value="">Day:</option>
 <?php
 foreach($days as $d)
 {
 echo '<option value="'.$d.'">'.$d.'</option>';
 }
 ?>
 </select>&nbsp;
 <select name="reg_year">
 <option value="">Year:</option>
 <?php
 foreach($years as $y)
 {
 echo '<option value="'.$y.'">'.$y.'</option>';
 }
 ?>
 </select>
 </div>
 <div>
 <div><input type="submit" name="signup" value="Sign Up" /></div>
 </div>
 </div>
 </form>
 </div>
 <div>
 <?echo validation_errors();?>
 </div>
 </div>
 <div id="r_pan">
 </div>
 <div id="footer">

 </div>
</div>

</body>
</html>

Thats all our index view is over now we have to make the form work note that i have  declared the form action to signup controller we haven’t created that yet, lets create!

The Signup Controller:

Class Signup extends Controller
{
 public function __Construct()
 {
 parent::Controller();
 }

 public function Index()
 {
 $rules = array(array('field'=>'reg_fname','label'=>'Full Name','rules'=>'required'),
 array('field'=>'reg_email','label'=>'Email','rules'=>'required|valid_email|callback_emailExists'),
 array('field'=>'reg_passwd','label'=>'Password','rules'=>'required|min_length[6]'),
 array('field'=>'reg_sex','label'=>'Sex','rules'=>'required'),
 array('field'=>'reg_month','label'=>'Month','rules'=>'required'),
 array('field'=>'reg_day','label'=>'Day','rules'=>'required'),
 array('field'=>'reg_year','label'=>'Year','rules'=>'required')
 );
 $this->form_validation->set_rules($rules);
 if($this->form_validation->run() == FALSE)
 {
 $month = $this->common->getMonthString();
 $day = $this->common->getDays();
 $year = $this->common->getYears();
 $data = array('months'=>$month,'days'=>$day,'years'=>$year);
 $this->load->view('index_view',$data);
 }
 else
 {
 $fname = $this->input->post('reg_fname');
 $email = $this->input->post('reg_email');
 $passwd = $this->input->post('reg_passwd');
 $sex = $this->input->post('reg_sex');
 $month = $this->input->post('reg_month');
 $day = $this->input->post('reg_day');
 $year = $this->input->post('reg_year');
 $this->common->signup($fname,$email,$passwd,$sex,$month,$day,$year);
 $this->load->view('registration_success',array('email'=>$email));
 }
 }
 public function emailExists($str)
 {
 if($this->common->check_email($str) == true)
 {
 $this->form_validation->set_message('emailExists', 'This '.$str.' email is already associated with another account, try loggin in or use another email');
 return FALSE;
 }
 else
 {
 return TRUE;
 }
 }
}

Explanation:

First we created the construct function and we called the parent construct function next we create an index function and there we validate our form inputs using form_validation library of CodeIgniter framework its so easy as you can see we are passing an two-dimensional array containing the field names of the form elements and their label names and the rules, to a function called set_rules next we call the function run() of form_validation this function does all the validation dirty jobs, and returns false if something invalid else it will return true, note that i’ve provided an callback function emailExists to the email rules  this function checks whether the email is already exists or not if exists it will return false by setting an error message else it will return true, next if everything is alright we pass the informations to the database and show the user that an email has been sent to confirm his registration we will create this part later.

Use FCBKcomplete in Codeigniter

December 2, 2009 · Leave a Comment
Filed under: CodeIgniter, Featured 

In my recent project I use FCBKcomplete to handle multiselect autosuggestion script But I have some problem when combine it codeigniter What is FCBKcomplete FCBKcomplete is Jquery plugin that allow you to make autocompleter

Related Links:

CodeIgniter- Doctrine ORM Tutorial: A way of enhancing CI

November 7, 2009 · Leave a Comment
Filed under: CodeIgniter, Featured 

Being inspired by the wonderful series of articles/screencasts on the nettuts website called CodeIgniter From Scratch I decided to write my own series on using CodeIgniter and Doctrine together to build a functional website in a series of tutorials.

In this first part of series, I will show you how to create a basic CodeIgniter install and add Doctrine as a plug-in.

“CodeIgniter and Doctrine from Scratch” Series:

download_code

Why add Doctrine to CodeIgniter?

Before we get started, first let me explain the reason I am doing this. Doctrine is an Object Relational Mapper for PHP. It’s OK if you don’t know this term. It basically means that you can map your database tables to classes in your web application. And instances of these classes (i.e. objects) represent records in the database.

This makes it very easy to create, read, update and delete records from the database, while handling them almost like regular objects, so you don’t even have to write any queries. It will also handle relationships between your tables. There are several other benefits that I will not get into until later in these tutorials. See the Doctrine Introduction, if you would like more info right now.

Here is an illustration I put together, that might give you a visual picture.

CodeIgniter Doctrine

First Step: Setup your development environment

If you already have a web server with PHP and MySQL setup, you can skip some of this.

  • Download and install WAMP (for Mac: MAMP)
    Warning Skype Users: You must shutdown Skype first before you start up WAMP, due to a port conflict. After WAMP starts up, you can open Skype again.
  • Visit http://localhost/ in your browser to make sure it’s working
  • Open the “www” folder under the WAMP installation.
  • Create a folder named “ci_doctrine_day1″. We will put our files here.

Install CodeIgniter

  • Download CodeIgniter
  • Extract and copy the contents into your new “ci_doctrine_day1″ folder.
  • You may delete the “user_guide” folder.

Your new folders should look like this:

ci_doctrine_day1_1

You should see this:

ci_doctrine_day1_3

CodeIgniter Crash Course: Controllers

Controllers are called by CodeIgniter on every page load.
They are located under:

system/application/controllers/

The url structure looks like this:

http://localhost/ci_doctrine_day1/index.php/CONTROLLER_NAME/FUNCTION_NAME

For example if you open this url:

http://localhost/ci_doctrine_day1/index.php/hello/world

CodeIgniter will look for a controller class named “Hello” and call it’s method named “world()”.

So let’s create our first controller.

Our First Controller

  • Create this file: system/application/controllers/hello.php
01 <?php
02 // system/application/controllers/hello.php
03
04 class Hello extends Controller {
05
06 function world() {
07 echo "Hello CodeIgniter!";
08 }
09
10 }

You should see:

Hello CodeIgniter!

Please Note:

  • The class must extend Controller.
  • The class name must be capitalized.
  • The file name must be lowercase.

Recommended Reading:

Install Doctrine

CodeIgniter allows us to add plug-ins. That’s how we will be installing it.

  • Create this folder: system/application/plugins
  • Create this folder: system/application/plugins/doctrine
  • Download Doctrine
  • Extract the files. Find the folder named “lib” and copy it to system/application/plugins/doctrine.

Now your folders should look like this:

ci_doctrine_day1_5

  • Create the plug-in file: system/application/plugins/doctrine_pi.php
01 <?php
02 // system/application/plugins/doctrine_pi.php
03
04 // load Doctrine library
05 require_once APPPATH.'/plugins/doctrine/lib/Doctrine.php';
06
07 // load database configuration from CodeIgniter
08 require_once APPPATH.'/config/database.php';
09
10 // this will allow Doctrine to load Model classes automatically
11 spl_autoload_register(array('Doctrine', 'autoload'));
12
13 // we load our database connections into Doctrine_Manager
14 // this loop allows us to use multiple connections later on
15 foreach ($db as $connection_name => $db_values) {
16
17 // first we must convert to dsn format
18 $dsn = $db[$connection_name]['dbdriver'] .
19 '://' . $db[$connection_name]['username'] .
20 ':' . $db[$connection_name]['password'].
21 '@' . $db[$connection_name]['hostname'] .
22 '/' . $db[$connection_name]['database'];
23
24 Doctrine_Manager::connection($dsn,$connection_name);
25 }
26
27 // CodeIgniter's Model class needs to be loaded
28 require_once BASEPATH.'/libraries/Model.php';
29
30 // telling Doctrine where our models are located
31 Doctrine::loadModels(APPPATH.'/models');
32
33 // (OPTIONAL) CONFIGURATION BELOW
34
35 // this will allow us to use "mutators"
36 Doctrine_Manager::getInstance()->setAttribute(
37 Doctrine::ATTR_AUTO_ACCESSOR_OVERRIDE, true);
38
39 // this sets all table columns to notnull and unsigned (for ints) by default
40 Doctrine_Manager::getInstance()->setAttribute(
41 Doctrine::ATTR_DEFAULT_COLUMN_OPTIONS,
42 array('notnull' => true, 'unsigned' => true));
43
44 // set the default primary key to be named 'id', integer, 4 bytes
45 Doctrine_Manager::getInstance()->setAttribute(
46 Doctrine::ATTR_DEFAULT_IDENTIFIER_OPTIONS,
47 array('name' => 'id', 'type' => 'integer', 'length' => 4));

Read the comments in the code for explanations. However, don’t worry if you don’t understand all of it for now.

Database Setup and Configuration

ci_doctrine_day1_6

  • Edit file: system/application/config/database.php
  • Find the lines below and input the values.
1 // in system/application/config/database.php
2 // ...
3
4 $db['default']['hostname'] = "localhost";
5 $db['default']['username'] = "root";
6 $db['default']['password'] = "";
7 $db['default']['database'] = "ci_doctrine";
8
9 // ...

We just edited the database configuration file of CodeIgniter.

More Configuration

Almost done.

config.php

  • Edit file: system/application/config/config.php
1 // in system/application/config/config.php
2 // ...
3
4 $config['base_url'] = "http://localhost/ci_doctrine_day1/";
5
6 // ...

Now CodeIgniter knows the url of our site.

autoload.php

  • Edit file: system/application/config/autoload.php
1 // in system/application/config/autoload.php
2 // ...
3
4 $autoload['plugin'] = array('doctrine');
5
6 // ...

This makes sure the Doctrine plug-in is always loaded.

Finished!

Now we’re ready to rock. Let’s start testing our setup.

Our First Doctrine Model

Create a user Table

  • Open phpMyAdmin: http://localhost/phpmyadmin/
  • Go to database “ci_doctrine”
  • Create a table named “user” with columns:
    id => int, primary key, auto_increment,
    username => varchar(255), unique,
    password => varchar(255),
    first_name => varchar(255),
    last_name => varchar(255)

You may use this query:

CREATE TABLE `ci_doctrine`.`user` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`username` VARCHAR( 255 ) NOT NULL ,
`password` VARCHAR( 255 ) NOT NULL ,
`first_name` VARCHAR( 255 ) NOT NULL ,
`last_name` VARCHAR( 255 ) NOT NULL ,
UNIQUE (
`username`
)
)

ci_doctrine_day1_7

Create the Model

  • Create file: system/application/models/user.php
01 <?php
02 // system/application/models/user.php
03 class User extends Doctrine_Record {
04
05 public function setTableDefinition() {
06 $this->hasColumn('username', 'string', 255);
07 $this->hasColumn('password', 'string', 255);
08 $this->hasColumn('first_name', 'string', 255);
09 $this->hasColumn('last_name', 'string', 255);
10 }
11
12 }

Note:

  • We extend Doctrine_Record, instead of Model (which you normally would with CodeIgniter models).
  • Inside the function setTableDefinition() we need to define the table structure.
  • By default, Doctrine will look for a table with same name as the class. In this case: “user”. (this can be changed)
  • In our doctrine_pi.php file above in this tutorial, we specified for a default primary key named “id”. Therefore we don’t need to put it again in our User class.

Testing the Model: Add Some Users

  • Edit our controller we created earlier: system/application/controllers/hello.php
01 <?php
02 // system/application/controllers/hello.php
03
04 class Hello extends Controller {
05
06 function world() {
07 echo "Hello CodeIgniter!";
08 }
09
10 function user_test() {
11
12 $u = new User;
13 $u->username = 'johndoe';
14 $u->password = 'secret';
15 $u->first_name = 'John';
16 $u->last_name = 'Doe';
17 $u->save();
18
19 $u2 = new User;
20 $u2->username = 'phprocks';
21 $u2->password = 'mypass';
22 $u2->first_name = 'Codeigniter';
23 $u2->last_name = 'Doctrine';
24 $u2->save();
25
26 echo "added 2 users";
27 }
28
29 }

We just generated 2 objects, and populated them with some data. Simply calling save() should save them into our database.

Note:

  • We are able to access the fields as parameters (e.g. $u->username), even though we did not create these as class parameters. Isn’t Doctrine nice?
  • If you are familiar with CodeIgniter, you might remember that you need to call $this->load->model() function to load models. However since we registered the autoload function of Doctrine, just saying “new User;” is enough.
  • We didn’t create the “save()” function, because it comes from the Doctrine_Record class we extended. It saves the objects to the database. There are many other functions and goodies that come with Doctrine classes, we will see later in the tutorials.

You should see output:

added 2 users

Voila! Now you should be able see the 2 new records that just got created.

ci_doctrine_day1_8

Stay Tuned

We just saw how to install and setup CodeIgniter with Doctrine. It took some work, but now we have a powerful MVC framework and ORM combination.

In the next tutorials, I will show you more practical examples and eventually build a functional website. You will see how easy it is to create models with Doctrine and save time from having to write repetitive CRUD (Create, read, update and delete) functions in all of your models.

Doctrine will also help us handle the relationships between our classes, and let us avoid writing complex logic code and queries.

See you next time!

Cookie tutorial? | CodeIgniter Forums

November 4, 2009 · Leave a Comment
Filed under: CodeIgniter, Featured 

Hi Cheese and welcome to the CI forums.

There isn’t (well, there might be, but I haven’t seen one) but it’s probably because it’s such a generic / straightforward thing that only uses a handful of simple techniques.

Rather than think in terms of cookies, just think instead in terms of CI’s Session functions.

At login (a form, a controller, a model to do the database user/pass check) you set some session data.

You then have a function somewhere – I prefer the MY_Controller approach, but a helper would work similarly well – to identify if a user is logged in, which it does by simply checking for the presence of that bit of session data.

At logout, you unset that session data.

Login and auth systems seems like they aught to be really complicated, but they really aren’t.

All you are really doing is storing a username and password, then getting it back from the user and making sure it matches something in the database.

Sessions make doing this once per ‘session’ really nice and easy. Manual session and cookie handling is only slightly annoying. It’s one bit of magic that its really nice to allow to ‘just work’, and learn the details as they hit you in the head

PHP Cookie Tutorials

CodeIgniter search and pagination, terms and uri segments

October 12, 2009 · Leave a Comment
Filed under: CodeIgniter, Featured 

PHP, Python, MySQL, PostgreSQL, Apache, Linux & Ajax – Open Source DEVelopment ESSENCE.


Marius Boitor devessence – http://www.devessence.com/

Codeigniter tutorial – To do list application | KomunitasWeb

September 11, 2009 · 1 Comment
Filed under: CodeIgniter, Featured 

What is CodeIgniter?

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks

CodeIgniter has an excellent documentation. It’s really help you in getting started. If you new to CodeIgniter, you can start by reading the user guide or read this excellent article Everything You Need to Get Started With CodeIgniter.

If you’re ready with your CodeIgniter, now we will create complete application using codeigniter. Building to do list in CodeIgniter. Let’s get started.

Open system/application/database.php, and change the following database configuration to fit your mysql configuration.

$config['hostname'] = "localhost";
$config['username'] = "myusername";
$config['password'] = "mypassword";
$config['database'] = "mydatabase";
$config['dbdriver'] = "mysql";

Then open system/application/config.php

$config['global_xss_filtering'] = TRUE;

Open system/application/autoload.php, and add database as autoload library so we don’t need to load database in every controllers.

$autoload['libraries'] = array('database');

Open system/application/routes.php, change default controller to todo controller as we’ll create later on this tutorial.

$route['default_controller'] = 'todo';

Model

First, we create table called todo table, and add some dummy data.

CREATE TABLE IF NOT EXISTS `todo` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`description` text,
`status` int(11) NOT NULL DEFAULT '1',
PRIMARY KEY  (`id`)
) ;

INSERT INTO `todo` (`id`, `name`, `description`, `status`) VALUES
(1, 'Buy flower', 'Buy flower for the girl next door', 1),
(2, 'Phone my dad', NULL, 1);

Now we need to create file in /system/application/models/ the new file should be called todo_model.php. After creating the file, add the following code to it.

<?php
class Todo_model extends Model {

    public function __construct()
    {
        // model constructor
        parent::__construct();
    }

    function getCompletedTodo()
    {
        $query = $this->db->get_where('todo', array('status' => '0'));		
        return $query->result();
    }

    function getNextTodo()
    {
        $query = $this->db->get_where('todo', array('status' => '1'));	
        return $query->result();
    }
}
?>

Controller

Create a new file under /system/application/controllers/ called todo.php. And for this tutorial, we only create index function to show our current to do list and completed to do list. Later on, we’ll create more function for our to do list application. Add the following code to your file.

<?php
class Todo extends Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->model('Todo_model');
    }

    function index()
    {
        $data['todo_list'] = $this->Todo_model->getNextTodo();
        $data['completed_list'] = $this->Todo_model->getCompletedTodo();
        $this->load->view('todo/index', $data);
    }
}
?>

View

I really like to organize view page based on controller, so I create todo folder under system/application/views/. Then I create file index.php under system/application/views/todo/

<html>
    <head>
        <title>CodeIgniter To Do List Application</title>
    </head>
<body>

<h1>Welcome to CodeIgniter To Do List Application!</h1>

<h2>Next</h2>
<?php if($todo_list): ?>
<ul>
    <?php foreach($todo_list as $todo): ?>
    <li><h3><?= $todo->name ?></h3>
    <?php if($todo->description): ?><p><?= $todo->description ?></p><?php endif ?>
    </li>
    <?php endforeach ?>
</ul>
<?php else: ?>
None
<?php endif ?>

<h2>Completed</h2>
<?php if($completed_list): ?>
<ul>
    <?php foreach($completed_list as $todo): ?>
    <li><h3><?= $todo->name ?></h3>
    <?php endforeach ?>
</ul>
<?php else: ?>
None
<?php endif ?>
</body>
</html>

That’s it. You can go to your browser, and see the result. Don’t hesitate to ask me, if something goes wrong on your side. In the upcoming tutorial, we’ll add more features. Thank you for reading this tutorial.

Source code for this tutorial : todo.zip

Next Page »