Welcome Guest, Not a member yet? Register   Sign In
Bootstrap integration with Codeigniter.
#10

(02-14-2015, 01:33 AM)Ujitha Wrote: This lesson will help you to understand how to integrate bootstap with Codeigniter.

First remember this is just a skelton example.

Ok..Lets go.

Step 01 :

Download Bootstrap form it's official website.

Step 02 :

Create a folder called 'assets' in /wamp/www/CodeIgniter directory[In WAMP server].
N.B CodeIgniter in above directory is the name of my project.
Unzip the above downloaded folder and copy all(css,js,fonts folders) the folders inside that folder.
Paste them inside the assets folder.

Please check that the path is correct to bootstap.

\wamp\www\CodeIgniter\assets\css
\wamp\www\CodeIgniter\assets\fonts
\wamp\www\CodeIgniter\assets\js




Step 03 :

Open the config.php in /CodeIgniter/application/config directory,

And edit it as

$config['base_url'] = 'http://localhost/codeigniter/';

Step 04 : Create the controller as boots.php and save belows in  it.

<?php

class boots extends CI_Controller
{
public function getBoots()
{
$this->load->view('samplebootstrap');
}

}

?>

Step 05 :

Create the view file as samplebootstrap.css and save beloes in it.

<link  href="<?php echo base_url('assets/css/bootstrap.css');?>" rel="stylesheet">
<link  href="<?php echo base_url('assets/css/bootstrap.min.css'); ?>" rel="stylesheet">

<div class="container">

<?php echo form_open("boots/getBoots",'class="form-inline"'); ?>
</br>
<legend>Enter the data </legend>
</br>

<div style="margin-left:30%;margin-top:20px;" >

<div class="form-group">
<label for="employeeno" class="control-label">Employee No :</label> <input type="text" name="name" class="form-control" />
</div>


</br>

</br>
<div class="form-group">
<label for="age" class="control-label">Age :</label> <input type="text" name="age" class="form-control" />
</div>
</br>
</br>
<input type="submit" name="name" class="btn btn-primary"/>

</div>

<?php echo form_close(); ?>
</div>

Step 06 :

Now That is all go to the web browser and type

http://localhost/codeigniter/index.php/boots/getBoots

You will see a form which has applied the bootstrap.
Dear sir ,

I am getting error . I have tried your code with the exact file path as you mentioned in your code.
How to solve this php error

A PHP Error was encountered
Severity: Error
Message: Call to undefined function base_url()
Filename: views/samplebootstrap.php
Line Number: 1
Backtrace:
Reply


Messages In This Thread
RE: Bootstrap integration with Codeigniter. - by witslinux - 04-28-2016, 06:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB