codeigniter

Solution to multi server environment with a CodeIgniter website

I have a local, staging and production environment for my CodeIgniter based site. Increasingly I find everytime I deploy a version I have more and more little bits of code to change because of server variations. What would be a good (and quick) solution I could add that would allow me to set these variables by just using one setting. Wh...

Form Helper: Any other benefit?

Hello all, I am new to codeigniter and I have just created a test login system. Chuffed... I would like to make a form for this login system as I have just been passing the username/password directly for testing. I am trying to work out the benefits of using the form helper. It helps me contsruct a form easily but can I not do this in...

Codeigniter preg_replace_callback

I would like for preg_replace_callback to use a library function from CodeIgniter as its callback. My current unsuccessful attempt is the following: $content = preg_replace_callback('/href="(\S+)"/i', '$this->util->url_to_absolute("http://www.google.com","$matches[0]")', $content); But I haven't had any success. I've tried usi...

why i dont receive my post values of text box

hi from these for loop iam using javascript to calculate the total of mark1,mark2,mark3 and the average of the total... <input type="text" name="tblRowCount" id="tblRowCount" /> <table align="center" width="100%" border="0" class="table_Style_Border" id="table"> <input type="text" name="txtrowcount" id="txtrow...

mySQL help in codeigniter

Hello, I am running a query to populate a dropdown menu, however the column I am using a list of company names, this means that the company name is often repeated, is there way to only get each repeated value only once? So for instance if I have in the table something like, Company 1 Company 1 Company 2 Company 3 Company 4 Company 4 ...

Codeigniter Shared Resources - Opinions Wanted

I run multiple websites all running off of a single installation of CodeIgniter on my server (separate application directories and a single system directory). This has been working fabulously and I don't see any reason to change it at this point. I find myself writing library classes to extend/override CI all of the time and many times...

Creating directories from filename?

Hi! I'm creating website that handles "great amount" of images. I have decided to use multiple directories method for storing files eg. images/efg/ed/ehj/efgedehjokjvdf2jn4.jpg I'm thinking that to prevent filename duplication is to take current timedate + some random string + md5 those = nice line of random string. Mostly I'm wonderin...

MongoDB and CodeIgniter

Can anyone assist in pointing me to a tutorial, library, etc. that will allow me to work with MongoDB from CodeIgniter? Any help is really appreciated. ...

How to make MySQL treat underscore as a word separator for fulltext search?

I am using MySQL fulltext and PHP (codeigniter) to search a database containing RSS items. Problem is some of these items's titles use underscores instead of spaces. Since MySQL considers underscores as part of a word, these items will never be matched in the search, unless the user types the exact title including underscores. Server is...

Putting some values into the fields before the first submission

Hi, CI form_validation is working perfectly... but how can I put some values into the fields before the first submission? (edit page) Thnaks. ...

Remove unnecessary error message with form validation

Using Codeigniter, I'm able to create a function for user authentication. I have a function that I call to check if the username/password given are valid. The problem I'm having is, I don't want the code to display "Invalid Login" if a password isn't given. It should read "Password is required" or something like that. I guess I could NO...

How coarse grained should the model be in an MVC framework?

Hello all, I have been reading a few questions previously asked and I haven't come across one that answers my question in "black and white" for me! So, apologies if this is repetitive. The question is probably similar to asking, "how long is a piece of string" but bear with me! For a registration system, I have a user model with functi...

Can 1330316 AJAX requests crash my server?

I'm building a small PHP/Javascript app which will do some processing for all cities in all US states. This rounds up to a total of (52 x 25583) = 1330316 or less items that will need to be processed. The processing of each item will take about 2-3 seconds, so its possible that the user could have to stare at this page for 1-2 hours (or...

PHP and mySQL help

Hello there I have a database that has 2 tables in it, one is the categoryTable and the is the userMenuTable, the categoryTable currently has two columns in it, categoryId and categoryTitle it currently holds 2 rows of data, the categoryId's = 1 and 2 and the categoryTitles = News and Blog, in the the userMenuTable I keep a record of wh...

codeigniter redirect

My redirect is not working, I can see no reason why it is not working thouhg, can anyone see a reason, function createCookie() { $this->load->helper('url') // Function gets called when the user clicks yes on the firstTime menu. // The purpose of this function is to create a cookie for the user. // First we'll gi...

Help with MySQL query clause in CodeIgniter

I need some help solving a problem with mySQL, is it possible to pass an array to a function and then run a match agains the array values? I have this query function getMenu($cookieId) { $this->db->select('*'); $this->db->from('categoryTable'); $this->db->join('userMenuTable', 'categoryTable.categoryId = userMenuTable.categ...

Codeigniter diffrent DB for each language

hey, I'm using codeigniter and the project i'm working on has to be in two languages. The only thing i can't figure out is how to select a different database in codeigniter when a session variable is set to a certain value. example: if the session variable 'language' is set to 'EN' i want it to select the DB: "databasename_EN" in al...

Redirect *.php to clean URL

My htaccess doesn't quite work: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\.php$ /blah/$1 [R=301,L] RewriteRule ^(.*)$ /blah/index.php/$1 [L] Basically /blah/about.php should redirect to /blah/about I'm using codeigniter so the last line is required to process URL's. Th...

Struggling with model relationships

I'm having a hard time designing a relationship with a few models in my project. The models are: band, musician, instrument Bands have multiple musicians Musicians have multiple bands and multiple instruments That’s all pretty straightforward, but I also need to keep track of what instruments a musician has for a particular band. So ...

How can I access a codeigniter config variable from a model/controller?

I would like to access the $db['default']['dbprefix'] variable from /application/config/database.php from within a model so I can write my own queries using the value from the file. How can this be done? ...