CodeIgniter
Passing Parameters Between Controller and View in CodeIgniter
In this article We are going to discuss about How to create and passing the parameters between controller and views in CodeIgniter (CI). In my previous article, I have explained about How to Create a Hello World application in CodeIgniter (CI).
In my previous article, I have clearly explained How to create controllers and views. So, In this article just explain about how to passing the argument (parameters) between controllers and views in CodeIgniter (CI).
Step 1 :
Open the already created "helloworld.php" file in the folder "<root folder>/application/controllers". Add the some codes in that file. The final "helloworld.php" file contains the below codes.
<?php
class Helloworld extends CI_Controller
{
var $text_to_display;
var $text_color;
public function __construct()
{
parent::__construct();
$this->text_to_display = 'World!';
$this->text_color = 'red';
}
public function display()
{
$data['text_to_display'] = $this->text_to_display;
$data['text_color'] = $this->text_color;
$this->load->view('display_view',$data);
}
}
?>
Step 2:
Open the view file "display_view.php" file in the folder "<root folder>/application/views" and add some codes in that file. The final "display_view.php" file contains the below codes.
Hello <font color="<?php echo $text_color; ?>"><?php echo $text_to_display; ?></font>
Step 3:
Paste the below URL in the browser address bar and see the output.
http://localhost/CodeIgniter/index.php/Helloworld/display
In my previous article, I have clearly explained How to create controllers and views. So, In this article just explain about how to passing the argument (parameters) between controllers and views in CodeIgniter (CI).
Step 1 :
Open the already created "helloworld.php" file in the folder "<root folder>/application/controllers". Add the some codes in that file. The final "helloworld.php" file contains the below codes.
<?php
class Helloworld extends CI_Controller
{
var $text_to_display;
var $text_color;
public function __construct()
{
parent::__construct();
$this->text_to_display = 'World!';
$this->text_color = 'red';
}
public function display()
{
$data['text_to_display'] = $this->text_to_display;
$data['text_color'] = $this->text_color;
$this->load->view('display_view',$data);
}
}
?>
Step 2:
Open the view file "display_view.php" file in the folder "<root folder>/application/views" and add some codes in that file. The final "display_view.php" file contains the below codes.
Hello <font color="<?php echo $text_color; ?>"><?php echo $text_to_display; ?></font>
Step 3:
Paste the below URL in the browser address bar and see the output.
http://localhost/CodeIgniter/index.php/Helloworld/display

PHP CMS Frameworks
July 24, 2013
Read more →
CodeIgniter
Creating Hello World Application in CodeIgniter
In this article, we are going to discuss about How to create a Hello World application in CodeIgniter (CI). Before we start creating Hello World application in CodeIgniter (CI), we must know about Model View Controller (MVC) pattern. Because CodeIgniter (CI) follows the MVC pattern.
Step 1 : Creating Controller
Create a controller with the file name "helloworld.php" within "<root folder>/application/controllers" folder and write the following code in that file.
<?php
class Helloworld extends CI_Controller {
function display()
{
$this->load->view('display_view');
}
}
?>
Step 2 : Creating View
Create a View with the filename "display_view.php" within "<root folder>/application/views" folder and write the following code in that file.
Hello World!
Step 3: Run the Hello World application
Now run the above Hello World application by entering
"http://localhost/CodeIgniter/index.php/Helloworld/display" in the browser.
http://localhost/CodeIgniter/ --------> CodeIgniter root path
Helloworld -------------> Controller name
display ---------> View name
Step 1 : Creating Controller
Create a controller with the file name "helloworld.php" within "<root folder>/application/controllers" folder and write the following code in that file.
<?php
class Helloworld extends CI_Controller {
function display()
{
$this->load->view('display_view');
}
}
?>
Step 2 : Creating View
Create a View with the filename "display_view.php" within "<root folder>/application/views" folder and write the following code in that file.
Hello World!
Step 3: Run the Hello World application
Now run the above Hello World application by entering
"http://localhost/CodeIgniter/index.php/Helloworld/display" in the browser.
http://localhost/CodeIgniter/ --------> CodeIgniter root path
Helloworld -------------> Controller name
display ---------> View name
PHP CMS Frameworks
July 17, 2013
Read more →
Drupal
Plupload - Upload multiple images in Drupal
In this tutorial we are going to discuss about How to upload multiple images at a time in Drupal. By default, in Drupal we can able to upload images one by one. By using PLUpload module, we can upload multiple images at a time with progress bar in Drupal.
Default File upload methos in Drupal:
By default we can upload multiple images one by one. When we create a default image field, simply set the "Number of values" to more than 1 to upload multiple images. However it is difficult to use. To upload images we need to follow the below steps.
Default File upload methos in Drupal:
By default we can upload multiple images one by one. When we create a default image field, simply set the "Number of values" to more than 1 to upload multiple images. However it is difficult to use. To upload images we need to follow the below steps.
- Select an image
- Click Upload
- Wait for a new file upload area to appear
- Select an image
- Click Upload
- Wait for a new file upload area to appear
- Repeat until done ...

Now, we are going to see how to accomplish the multiple file upload in Drupla with PLUpload.
Modules and Files need to be install :
Install and enable these two modules:
- Plup: http://drupal.org/project/plup
- Libraries: http://drupal.org/project/libraries
We'll now to need to upload the files for Plupload.
- Go to http://www.plupload.com/download.php
- Click the Download link shown below:

- Extract the files that you just downloaded. You'll get a folder called /plupload/
- Browse to the /sites/all/ folder in your Drupal site
- If you don't have a /libraries/ folder here, create one
- Upload the /plupload/ folder into your /libraries/ folder

Create a new field :
- Go to Structure > Content types > Manage fields
- Choose Image and then choose Plupload as the widget
- All of the settings will be identical to a normal image field

- Finish creating the field
- Go to Content > Add content and create a new content item
- You'll see a multiple file upload area as in the image below
- To upload images, you can either drag files into the marked space or you can click Add

- Add all the images you want to upload
- Click Upload

- You'll see a small progress bar:

- You'll see thumbnails of the images:

PHP CMS Frameworks
July 10, 2013
Read more →
No more posts to load.
About this blog
PHPCMSFramework.com
Tutorials for WordPress, Laravel, Drupal, Joomla, Symfony & more — including AI-powered PHP guides. Publishing since 2012.
Trending posts
- Building a RAG System in Laravel from Scratch
- Steps to create a Contact Form in Symfony With SwiftMailer
- Build an AI Code Review Bot with Laravel — Real-World Use Case
- Build a WhatsApp AI Assistant Using Laravel, Twilio and OpenAI
- CIBB - Basic Forum With Codeigniter and Twitter Bootstrap
- Drupal 7 - Create your custom Hello World module
- Create Front End Component in Joomla - Step by step procedure
- A step by step procedure to develop wordpress plugin
- Migrating a wordpress website to Joomla website
- Laravel and Prism PHP: The Modern Way to Work with AI Models