Welcome Guest, Not a member yet? Register   Sign In
Created a file named MY_Config.php and placed inside the application/libraries folder:
#1

[eluser]crimsun[/eluser]
Class MY_Config extends CI_Config

{



function MY_Config()

{

parent::Config();

} //Controller End



//Config extends to database



function db_config_fetch()

{

//Create Codeigniter object

$CI =& get_instance();



//Condition - Get System Related Variables

$CI->db->where('setting_type', 'S');

$CI->db->select('code,value_type,int_value,string_value,text_value');

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



foreach ($query->result() as $row)

{

// Conditions based on value type field

if($row->value_type =='I' )

{

$this->set_item(strtolower($row->code),$row->int_value);

}//if End

if($row->value_type =='T' )

{

$this->set_item(strtolower($row->code),$row->text_value);

}//if End

if($row->value_type =='S' )

{

$this->set_item(strtolower($row->code),$row->string_value);

} //if End

}// Foreach End



} //Function end db_config_fetch

} //Class


This file is working properly for my old project which is in CI vversion 1.7.3
But i am using the latest version for my new project and its completely give me error in the new controller files...actully my purpose to use this use some common setting variable which is used in controller that i fetch from database as like this...

$this->config->db_config_fetch();

But now its not working me for CI version 2.0.1

Fatal error: Call to undefined method CI_Config::db_config_fetch() in /opt/lampp/htdocs/mydemoproject/application/controllers/siteadmin/login.php on line 16

So please guide how i remove this error so i can able to implement multiple language in my project...

Thanks in Advance Smile
#2

[eluser]InsiteFX[/eluser]
You have to place it in application/core

all extended CI core files go into application/core

InsiteFX
#3

[eluser]crimsun[/eluser]
Smile Thanks very much its working fine .....if any problem then i will post here...
#4

[eluser]crimsun[/eluser]
Is there is any htaccess which is useful for the CI version 2.0.1. to remove index.php so please suggest me
#5

[eluser]InsiteFX[/eluser]
You can try this one, but different systems can cause problems.
Code:
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # you may need to remove the ? after index.php depends.
    RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
</IfModule>

<IfModule !mod_rewrite.c>
    ErrorDocument 404 /app_name/index.php
</IfModule>

InsiteFX
#6

[eluser]crimsun[/eluser]
hey Thanks for your response will try this....but i face some more problem as form_validation class is used in my project for validation purpose but when i use set_value in view page and also use form_error it gives me error as

Fatal error: Call to undefined function set_value() in /opt/lampp/htdocs/shouts/application/views/default/admin/login.php on line 24

Help me for this how should i resolve this

Thanks Smile
#7

[eluser]InsiteFX[/eluser]
Did you load the form_helper ?
Code:
$this->load->helper('form');

Or if you use it a lot autoload it in application/config/autoload.php

InsiteFX
#8

[eluser]crimsun[/eluser]
actually i got the above error because of problem in htaccess Becuase when i click on may link so its add "?" after the main folder name and i used your htaccess rule but still i got same problem ....
#9

[eluser]crimsun[/eluser]
I face some problem while redirect the link there is one symbol as "?" is added in every link

http://localhost/projectname/?siteadmin/login

Its not working ....i actually have this following link in my url

http://localhost/projectname/siteadmin/login

And this is the my htaccess code

#RewriteCond $1 !^(index\.php|assets/|robots\.txt)
#RewriteRule ^(.*)$ index.php/$1 [L]

RewriteCond %{REQUEST_URI} ^system.
RewriteRule ^(.*)$ /?index.php/$1 [L]


#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

So please kindly help me to resolve this problem
Thanks in advance Smile




Theme © iAndrew 2016 - Forum software by © MyBB