Showing posts with label Codeigniter. Show all posts
Showing posts with label Codeigniter. Show all posts

Tuesday, February 05, 2008

Remove index.php

Backup httpd.conf file of apache, all the changes has to be done in this file.

search for "LoadModule rewrite_module modules/mod_rewrite.so" and

remove # from the "#LoadModule rewrite_module modules/mod_rewrite.so" string. Removing '#' from the above line will actually enable the rewrite module on server.

paste the following, if not there

<FilesMatch "^\.ht">

Order allow,deny

Deny from all

</FilesMatch>


paste the following, if not there

AccessFileName .htaccess

above line will use the file name to use, will rewriting.

paste the following, if not there

IndexIgnore .htaccess

above line will remove the .htaccess from the indexing service of apache

AND THE MOST IMPORTANT TASK

search for this :

<Directory />

Options FollowSymLinks

AllowOverride None

Order deny,allow

Deny from all

Satisfy all

</Directory>



and replace by :


<Directory />

Options FollowSymLinks

AllowOverride all

Order deny,allow

Deny from all

Satisfy all

</Directory>


'all' string will allow the mod_rewrite to run for all the requests coming to server.



create one .htaccess file, you won't be able create such file in windows system, so WAMP user download it from any web server. or find some other source.



and paste following in the .htaccess file.

RewriteEngine on

RewriteCond $1 !^(index\.php|images|robots\.txt)

RewriteRule ^(.*)$ /index.php/$1 [L]


if using CI in some directory than use

RewriteEngine on

RewriteCond $1 !^(index\.php|images|robots\.txt)

RewriteRule ^(.*)$ /directory_name/index.php/$1 [L]


don't forget to restart the apache server, so that it reloads the httpd.conf file.


creating an alias(ignore these lines):
Alias /something "/www/webapps/joomla"

Friday, February 01, 2008

New Version Released

Glad to see the new version of codeigniter, i thing i was not able to understand, why scalfolding class being deprecated? many new things to study :-)
http://codeigniter.com

Sunday, January 27, 2008

database to array

This is a small idea to fasten your web application, this is a backend process, so we are not concerned with the users internet speed, but the stability of the system relies in the hand of backend server and our scripts, what if we load whole database in n number of arrays, where n is equal to number of tables. Load database to the autoload.php file.
Here is a method to create array of a table from the database.
Create one file application/libraries/MyDbArray.php
Paste the following content to it.
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class MyDbArray

{

public $CI;

public $db_array=array();

function __construct()

{

$this->CI=& get_instance();

$query=$this->CI->db->get('ci_content');

$this->db_array=$query->result();

}

}

?>

Controller
<?php

class dbarray extends Controller

{

function __construct()

{

parent::Controller();

$this->load->library('MyDbArray');

}

function index()

{

print_r($this->mydbarray->db_array);

}

}

?>