Showing posts with label Tutorial. Show all posts
Showing posts with label Tutorial. Show all posts

Saturday, March 18

How to Insert Update Delete Retrieve data using Codeigniter in MySQL Database


When you are going to create a codeigniter web application using database you can not create it without using the insert, update, delete and retrieve codes of codeigniter. In this tutorial we will show you How to Insert Update Delete Retrieve data using Codeigniter in MySQL Database.

Thursday, February 23

How to add Twitter Bootstrap in PHP CodeIgniter

How-to-add-Twitter-Bootstrap-in-PHP-CodeIgniter
A fair design is always important to make your codeigniter web application more choiceable to the users. When you are a web developer and looking for creating a fair design, bootstrap is the best choice .Bootstrap framework has a lot of css classes for developing responsive, mobile-first web sites. Codeigniter and twitter bootstrap works together excellently. In this tutorial we will show you how to add twitter bootstrap in your codeigniter web application.

Requirements to Start:

There are three things you need to add Twitter Bootstrap in PHP CodeIgniter:
  1. Installation of a localhost server: To start this tutorial you need to install a localhost server in your computer. There are many options on the internet and you can download any of them. We will recommend you to use xampp server. Xampp server is a cross platform server application which will be the most useful for you. 
  2. Download CodeIgniter: You have to download the codeigniter source file to get you started. If you already have the source file then you can get started with that. If you don't have codeigniter source file then you can download it from their official website - https://www.codeigniter.com/download .You can also Download their Github repository from  - https://github.com/bcit-ci/CodeIgniter .
  3. Download Twitter Bootstrap: You need the bootstrap compiled and minified file to get started. If you  have already downloaded bootstrap compiled and minified file then you have no problem to start with that. Other wise you can download the current version of bootstrap from their official website - http://getbootstrap.com/getting-started/#download .By opening this link you will see a button - 'Download Bootstrap'. Click on that button and proceed.
Now follow the bellow mentioned steps to add Twitter Bootstrap in your PHP CodeIgniter web application:

  1. Set up of Codeigniter
  2. Addition of Bootstrap file On Your Project
  3. Creation of Layout Page
  4. Link of Bootstrap on Layout Page
  5. Addition of HTML
  6. Checking of Output

Set up of Codeigniter

In order to add Twitter Bootstrap in your PHP CodeIgniter web application The first step you need to follow is setting up of Codeigniter on your web server or localhost. Set up your base url in 'config.php' file and set up url and file helper in 'autoload.php' file.For this tutorial we will not use any database, so you don't need to configure database. However, if you don't know how to configure base url and helpers in codeigniter you can check the tutorial - How to Install and Configure Codeigniter.

Addition of Bootstrap file On Your Project

Go to the root of your codeigniter project. Create a new folder 'template'. On this 'template' folder you will keep all bootstrap files that you have downloaded from the given link. After extract the bootstrap zip file you will get three folders: css, fonts and javascript. Copy and paste them on 'template' folder that you have created on the root of your codeigniter project.
Bootstrap-CodeIgniter-tutorial

Creation of Layout Page:

 You have to create a layout page - 'layout.php' in our application >> views folder to write some bootstrap integrated html codes.To make 'layout.php' visible you need to write some functions in your controller. Go to application >> controllers and open 'Welcome.php'. Write the bellow code:

public function layout()
{  
  $this->load->view('layout');
}

Link of Bootstrap on Layout Page:

To link bootstrap stylesheet that you have added on your project, open  'layout.php' from application >> views folder and copy bellow code inside the head section.


<title>Twitter Bootstrap integration on PHP CodeIgniter</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="<?php echo base_url();?>template/css/bootstrap.min.css">
<script src="<?php echo base_url();?>template/js/bootstrap.min.js"></script>

Addition of HTML:

You need to write some html and bootstrap codes on 'layout.php' to check whether your bootstrap links are working properly or not. Add the bellow code inside  the body tag of 'layout.php'.

<div class="container">
    <div class="row">
      <div class="col-md-4">
        <h3>Responsive Column 1</h3>
        <p>Resize to see the effect</p>
      </div>
      <div class="col-md-4">
        <h3>Responsive Column 2</h3>
        <p>Resize to see the effect</p>
      </div>
      <div class="col-md-4">
        <h3>Responsive Column 3</h3> 
        <p>Resize to see the effect</p>
      </div>
    </div>
  </div>

To minimise your complexity  we have  written bellow the entire code of 'layout.php'. If you feel any trouble to grasp the method You can also write the entire code in 'layout.php' as mentioned bellow .

<html lang="en">
<head>
  <title>Twitter Bootstrap integration on PHP CodeIgniter</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="<?php echo base_url();?>template/css/bootstrap.min.css">
  <script src="<?php echo base_url();?>template/js/bootstrap.min.js"></script>
</head>
<body>
  <div class="container">
    <div class="row">
      <div class="col-md-4">
        <h3>Responsive Column 1</h3>
        <p>Resize to see the effect</p>
      </div>
      <div class="col-md-4">
        <h3>Responsive Column 2</h3>
        <p>Resize to see the effect</p>
      </div>
      <div class="col-md-4">
        <h3>Responsive Column 3</h3> 
        <p>Resize to see the effect</p>
      </div>
    </div>
  </div>
</body>
</html>

Checking of Output

Open layout page from any browser to check if bootstrap style is added with codeigniter or not. If you see something like bellow it happens that you have added successfully the Twitter Bootstrap in PHP CodeIgniter.
Bootstrap-CodeIgniter-tutorial
Now resize your browser to see the responsive effects.

So these are the 6 simple steps to add Twitter Bootstrap in PHP CodeIgniter. If you need any further assistance you can freely comment bellow.We love helping our viewers to solve their problems.

We hope our tutorial on 'How to add Twitter Bootstrap in PHP CodeIgniter' will help you design great applications. If you liked this article, then please subscribe our newsletters for daily updates.

Sunday, February 19

Appearance Editor is not showing on Wordpress

Wordpress-tutorial

Wordpress is an one stop solution for many web masters and bloggers. Wordpress was created in such a way that a person who don't have knowledge in coding can easily use this.There is a lot of free and premium Plugins available on the internet for every development purposes.You can easily create an e-commerce  website or a forum website by simply installing a Plugin in Wordpress.The editor option on the Appearances is always required to make the necessary changes on Plugins and themes.

   The editor option of Appearance is missing on wordpress.This error is the most common problem that I have faced on wordpress. Almost in every website that I have created using wordpress.

  This is a configuration problem of wordpress. You will not be able to solve this problem by changing theme. If you deactivate all the Plugins of your website the problem will be till there.There are two methods to solve this problem.

Solution I - Disable Javascript Concatenation:

All Javascript files are concatenated into one URL to make administration area more faster. But some times javascript concatenation of administration area fails to work  which causes this type of errors.

You can disable this feature by following steps bellow:
  • Open the file wp-confic.php located on root of your wordpress project.
  • This file contains informations for connecting your wordpress project with the database. Find the bellow line.
    define('DB_HOST', 'hostname');
    Add the bellow line after that.
    define('CONCATENATE_SCRIPTS', false);

Solution II - Enable the Plugin and Theme Editor:

In some cases plugin authors avoid checking for user edit capability for security.This occurs the problem.

You can disable this feature by following steps bellow:
  • Open the file wp-confic.php located on root of your wordpress project.
  • Find the bellow line.
    define('DISALLOW_FILE_EDIT', true);
    Replace it with the bellow line
    define('DISALLOW_FILE_EDIT', false);

So those are the two solutions for missing editor option of Appearance in wordpress.If those solutions don't works for you please mention your on the comment section.Don't forget to subscribe for the newsletters.

Thursday, February 16

How to Remove index.php From url in Codeigniter using htaccess

codeigniter-remove-index-php
CodeIgniter urls are designed to be search-engine and human friendly.But, that by default 'index.php' which appears in the url of codeigniter applications is really awkward.To maintain the standards I always  remove the default 'index.php' from the codeigniter url so that the url becomes more search engine friendly and looks clean.
So today in this tutorial I will show you how to remove index.php from codeigniter url.
That 'index.php' can be removed from the codeigniter url by following some simple steps.First we will create an '.htaccess' containing codes to remove 'index.php' from the codeigniter url.We will save that '.htaccess' file on root of that codeigniter applications. We will also make necessary changes on the configuration files of that codeigniter application.It is as simple as bellow :

Step I - Download Codeigniter : You can download Codeigniter 3  from their official website - https://www.codeigniter.com/download .You can also Download Github repository of Codeigniter 3  - https://github.com/bcit-ci/CodeIgniter .

Step II - Create .htaccess File : The next step is create an '.htaccess' file.First open your favourite text editor and create a new text file.Now save it as ".htaccess" in the root directory of that codeigniter application. Some time the file saved as a text file. To avoid this problem type the file name within quotes.
codeigniter-remove-index-php

Now copy paste bellow code to the '.htaccess' file and save:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>  

Step III - Modify Config.php File : Now in the next step we will make some changes on the 'config.php' file. Go to application>>config folder of your codeigniter application.Open the file 'config.php'.
First Search for the bellow line in 'config.php'.

$config['index_page'] = 'index.php';

Replace this line with the bellow line

$config['index_page'] = '';

Again Search for the bellow line in 'config.php'.

$config['uri_protocol'] ='AUTO'

Replace this line with the bellow line

$config['uri_protocol'] = 'REQUEST_URI'

Now try to open your codeigniter application without 'index.php'. Hope it will open your application without 'index.php'. If your fell any problem on following those steps comment bellow. Thanks for reading this article. 

Saturday, June 21

How to Select Data from MySql table using PHP


Data can be fetched from MySQL tables by executing SQL SELECT statement through PHP function mysql_query.This tutorial will show you how to fetched data from mysql database.

Tuesday, May 20

How to Insert Data into MySql table using PHP

We can insert data into MySQL tables by executing SQL INSERT statement through PHP function mysql_query.This tutorial will show you how to insert data into mysql database.

Saturday, May 17

5 Best Place for Web Developers to Create Free Css Menu-Bar

PhotoCSS navigation bars are generally load more quickly then Javascript navigation bars  in visitors' browsers and creating various objects and effects with CSS is more easier  than the code necessary to create the same objects or effects in JavaScript.
So, here’s some butyfull online tools to create CSS Menubar for every web developers.