codeigniter

CodeIgniter/PHP/MySQL: Retrieving data with JOIN...

Hi, I'm new to PHP/MySQL and super-new to CodeIgniter.. I have information in many MySQL tables. I want to retrieve it with JOIN where the tables primary keys are equal to $variable... How can I do it and get all the fields without the primary key field??? What I'm doing now is this (only two tables joined here): function getAll($id) {...

MVC done right - Examples

I am new to both the MVC pattern and PHP frameworks. I picked up a copy of CodeIgniter for Rapid PHP Application Development, but the author does not use the M part of MVC and I can't seem to get his code examples to work. CodeIgniter's User Guide is not very detailed about what goes into which component either. What I'm looking for are...

CodeIgniter: Create new helper?

Hi, I need to loop lot of arrays in different ways and display it in a page. The arrays are generated by a module class. I know that its better not to include functions on 'views' and I want to know where to insert the functions file. I know I can 'extend' the helpers, but I don't want to extend a helper. I want to kind of create a help...

What would my controller be in these scenarios in a mvc web application?

1) Where does the homepage of your website fit into "controllers"? I've seen some people use a "page" controller to handle static pages like, about, home, contact, etc., but to me this doesn't seem like a good idea. Would creating a distinct controller just for your homepage be a better option? After all, it may need to access multipl...

To use a PHP framework or not?

I've started writing quite a few applications in PHP mainly for Wordpress and becoming more and more familiar with the language. Someone told me about CakePHP and Codeigniter and I wanted to get a better understanding of how these could help me and whether it's worthwhile spending the time to learn a framework? Thanks Jonathan ...

Merging two Images with CodeIgniter Image Manipulation Class

I am developing a new project in CodeIgniter (CI), and would like to find a CI solution to this current issue. I've got one image, which resembles a picture frame. I would like for uploaded images to be modified to have this frame in their background. Example: The first picture is the frame. The second is the uploaded image (after res...

how to move already written codeigniter code to kohana?

Hi, All I'm already using codeigniter for some time, and i liked it but it looks like i need to move to kohana, because my other team member need our code to fully use PHP5 feature. the problem is, we have already code half of the code in CodeIgniter. my question is: Did anyone here have done it before? Is it possible to do? how muc...

How to extend a helper in CodeIgniter?

I want to add some new functions to the core string helper which is found in system/helpers folder. I think there was a 'right' way to do this using MY_String_helper or something of that sort but I can't remember exactly how it was done. Any thoughts? ...

Active Record implementation of this SQL ?

I am using CodeIgniter. My database is MySQL 5. The SQL statement below works fine, but I am thinking it would not really be compatible with MSSQL, PG, et al. I am wondering if it's possible to implement the statement using the Active Record class in CI, hence making it completely cross database ? I think the "GROUP_CONCAT" is where I'l...

How do I create a decent error 404 handler for CodeIgniter?

CodeIgniter has /system/application/errors/error_404.php which is displayed when there is a 404 due to what is effectively a "controller not found" condition. However, for my project, I really need this error to be handled just like it is when a method is missing from the controller class. In that case, I show a normal view with a pretty...

Accessing codeigniter models in other models

It used to be that within a CodeIgniter model you couldn't access another model. E.g $this->load->model('bar'); $this->bar->something(); Would be invalid within the code of a model. Is this still valid or have they changed it? ...

Updating textfield in doctrine produces an exception

I have a textfield that contains say for example the following text:- "A traditional English dish comprising sausages in Yorkshire pudding batter, usually served with vegetables and gravy." This textfield is in a form that simply updates an item record using it's ID. If I edit part of the textfield and replace "and gravy." with "humous...

Best editor for CodeIgniter?

I'm learning CodeIgniter and I come from Microsoft Visual Studio so I'm used to the auto complete feature. I've been using notepad++ so far but I wonder if anyone knows an editor that works better with CodeIgniter. I would love to see features like: Right-click -> Add new model Right-click -> Add new view Autocomplete with CodeIgniter...

jQuery+AJAX delete anchor not working

Hi I'm using jQuery and Codeigniter. I'm creating a simple todo list that can add delete entries using ajax. The problem is whenever I click on my delete anchor, it won't delete the entry. The adding of the entry feature works BTW. Here's my code: todo_view.php <html> <head>Todo List</head> <script type="text/javascript" src=...

codeigniter populate form from database

In the controller, I have... function update($id = null) { $this->load->database(); // more code $data = array(); $data = $this->db->get_where( 'users', array( 'id' => $id ) ); $data = $data->result_array(); $data = $data[0]; // more code $this->...

Codeigniter : Problem inserting accents in Mysql.

Hi everybody, I'm trying out code igniter, and I came across an error message while trying to insert a new row in my Mysql database. The text I'm trying to insert is in French, and contains some accents. Here's my code : $data= array( 'title' => $this->input->post('title'), 'date' => $this->input->post('date'), 'mytext' => $thi...

Can I use Code Igniter with Concrete5?

I am building a site that will (obvisouly) have a front end public portion that I want to drive with Concrete5, but then it will also have a members section that I would like to build with Code Igniter. Does anyone have any idea how I could do that? I guess I could just throw the Code Igniter code into a sub directory, but would I run ...

AJAX and how to best deal with it server side in PHP

Hi, I'm starting to write quite a few ajax heavy website, but I've never really read up on best practices and now that I want too I can't find an article that address what I want to know. What I really want to learn about is dealing with AJAX calls server side, things such as, should all data be passed back using JSON/XML,.. or is pure...

Carrying row values from MYSQL after form submission.

What is the best way to carry an auto incremented ID from one form to another? I have 3 tables (users, residences, and users_residences). I want a user to register, be added to the users table, be redirected to a form to create a residence which will add a row to the residence table and simultaneously add the the residence tabe row's i...

Kohana: Which alternatives are available?

Since Kohana seems to be very poor documented and my time is valuable, I may want to stick with something that lets me get a web platform faster up and running. I know it forked from Code Igniter. I actually like the idea of Kohana, but since the big hole in documentation it seems to be a bad alternative. Well, almost everyone on the ne...