codeigniter

Codeigniter Routes regex

looking for a one line route to route dashed controller and method names to the actual underscored controller and method names. url /controller-name/method-name-which-is-long/ would route to /controller_name/method_name_which_is_long/ see: http://codeigniter.com/forums/viewreply/696690/ which gave me the idea to ask :) ...

Filter, sort and paginate in Codeigniter

Ive recently started using CodeIgniter as I was searching for a very lightweight framework and it seemed to come up as a top choice. I am new to the whole MVC thing, enjoying it but am stuck with something which seems very simple. I am coding a CMS and need a way to filter, sort and paginate the results. I am used to doing it with quer...

php syntax confusion accessing database result

I am trying to do the following: <?php foreach($sqlResult as $row): ?> <tr> <?php foreach($formdata['columns'] as $column): ?> <td><?php echo $row->$column['name']; ?></td> <?php endforeach; ?> </tr> <?php endforeach; ?> This does not work. $row is returned by my mysql query, it has the following :...

Can I unprotect a single script via .htaccess using CodeIgniter?

I'm in a development environment and we're using basic .htaccess/.htpasswd authentication to keep lurkers out. But some of my AJAX calls are coming back with HTTP/401 authentication failed errors. Is it possible for me to allow access only to those specific URL's? I can't easily do it by popping a new .htaccess in a subfolder because Cod...

MYSQL query results cut short when Sort is DESC and limited

Hi... Seeing some strange things; help is being solicited. I have a query, like so: (using CodeIgniter, btw) 'SELECT * FROM registers WHERE client_id='.$clid .' ORDER BY date DESC LIMIT '.$num $num is passed in through the function call (and it==15), and is echoing properly. But running this returns only 10 rows. If I explicitly set ...

CodeIgniter crop() without maintain_ration

I have this function above witch even maintain_ration set false, cutting with this proportion. In this case the result is an image with 150x113px, because the original image has 400x300. function do_crop() { $config = array( 'image_library' => 'gd2', 'source_image' => realpath(APPPATH . '../upload_img/solg6.jpg'), 'ne...

Performing both client side and server side validation using jQuery and CodeIgniter

What is the right way of doing both client side and server side validation using jQuery and CodeIgniter? I am using the jQuery form plugin for form submit. I would like to use jQuery validation plugin (http://docs.jquery.com/Plugins/Validation) for client side validation and CodeIgniter form validation on the server side. However the two...

My delete function does not delete the targeted file

Basically I could upload files based on a project. Whenever I create a project, a new directory is created with the directory name as the project_name e.g. this is a test -> this-is-a-test. But my problem is I couldn't delete a file in a directory. function delete_image($id) { $this->load->model(array('work_model', 'project_model')...

What's a good PHP Active Record library?

I've been using CodeIgniter for some quite time, and I've been extremely happy with its Active Record stuff. It's great to query the database with it. Recently I've started a new project and I can't use such a framework anymore. Is there a simple PHP Active Record library that does its job and gets out of the way (similar to CodeIgnite...

CodeIgniter Project Giving 303/Compression Error

Trying to setup a CodeIgniter based project for local development (LAMP stack), and once all the config file were updated (meaning I successfully had meaningful bootstrap errors for CodeIgniter), I get this error in my browsers: Chrome Error 330 (net::ERR_CONTENT_DECODING_FAILED): Unknown error. Firefox Content Encoding Error: The page...

CodeIgnitor is generating multiple sessions in the database, why?

Ive got a site that does a few ajax calls on page load, now for some reason, codeIgnitor is inserting 4 sessions (I'm assuming for each ajax call) as you load the page. I'm storing the sessions in the database. I'm pretty sure there should only be one session per browser? FF seems to only generate one, other browsers seem to create a wh...

Codeigniter Write_file Question

I am writing to a txt file to back up certain posts. Here is my simple code $this->path = APPPATH . "post_backups/"; $string = $this->input->post('post'); $post_title = $this->input->post('post_title'); $this->file = $this->path . $post_title."txt"; write_file($this->file, $string); $this->index(); Every thing w...

Validating form dropdown in CodeIgniter

Hi, I am using CodeIgniter's form helper and form validation library to build my forms. I'm having trouble making the dropdown 'sticky' and also finding appropriate validation rules. This is how I'm populating the drodown: foreach($events as $event){ $options[$event->event_title] = $event->event_title; } $firstItem = '<option>Please s...

howto Debugging on PHP

how we do basic debugging in PHP ? Can anybody share true horror story on debugging PHP application (or (even better) on PHP framework such Codeigniter and Wordpress) ? i love to hear real experience in case i have to encounter similar situation on my journey to learn PHP. ...

Few fat models vs. many slim models in CodeIgniter

Any difference, performance-wise? ...

Best approach for storing uploaded image

What are the advantages and disadvantages of storing an image as a blob in the database vs storing just the file name in the database. I'm using PHP(CodeIgniter) with MySQL. I know this question is subjective but a client asked me this question and I couldn't give a good answer. ...

How can I limit access to specific functions in CodeIgniter?

Hello, I have a huge controller in codeigniter, with many functions. I want to limit access to certain functions. How should I proceed? And can I call the functions using cron daemon??? Or should I place those functions in another controller?? ...

Sending ExtJS datastore parameter to CI controller

Hi all, I'm new to ExtJS and I'm stuck with ExtJS datastore. I'm using ExtJS with CodeIgniter and I want to send ExtJS datastore.load() parameter to my codeigniter's controller to process some query. How can I do that? Here is my ExtJS datastore proxy: var dataProxy = new Ext.data.HttpProxy({ url: 'index.php/cStart/js_listPegawai/'...

Codeigniter Session Data not available in other pages after login

So, I have set up a login page that verifies the user's credentials, and then sets codeigniter session data 'email' and 'is_logged_in' and a few other items. The first page after the login, the data is accessible. After that page, I can no longer access the session data. In fact, if I try reloading that first page, the session data is go...

Codeigniter image manipulation class rotates image during resize

I'm using Codeigniter's image manipulation library to re-size an uploaded image to three sizes, small, normal and large. The re-sizing is working great. However, if I'm resizing a vertical image, the library is rotating the image so it's horizontal. These are the config settings I have in place: $this->resize_config['image_libr...