CodeIgniter is an open-source PHP web development framework created by EllisLab Inc. The framework implements the Model-View-Controller design pattern. It is praised for its performance and the quality of its documentation.
0
votes
2answers
32 views
Codeigniter - in the view or in the controller?
Is this correct? Or am I overloading the responsibilities of the view?
<table class="table table-striped table-hover">
<thead>
<tr>
...
2
votes
1answer
72 views
Codeigniter: loading content in page via jQuery
Hi I'm doing a web site in codeigniter and I'm loading the content page via jQuery, but I don't know if this is a good practice or not. Could I improve it? Thanks.
jQuery
// Another question here, ...
0
votes
0answers
20 views
storing the data twice on the second occasion
I use php codeigniter, jquery ajax and datatables, this image is result when first save:
and this the second result when I click add button:
this my code in javascript:
function ...
1
vote
1answer
101 views
Codeigniter Registration Controller
Just wanted to post my registration controller and see what anybody thought about it.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Register
*
*/
class ...
1
vote
1answer
76 views
Design pattern usage - refactoring an old code in CI
everyone!
I'm rewriting a god object with lo-ong methods into something much more viewable and pretty.
However, I think there is something missing and can be done better. So I'm sending examples of ...
2
votes
1answer
245 views
Builder pattern for Codeigniter ActiveRecord queries
I am using Codeigniter and it's ActiveRecord.
I had this idea for a base class that provided a generic getter/setter for doing simple queries on a database. I have a lot of database objects that ...
0
votes
0answers
104 views
Delete function for Codeigniter Controller
This is my delete function that I will be using for most of my other controllers that need one.
The purpose of this is to delete the value that passed in to delete the item from the database table ...
3
votes
2answers
129 views
Helping to Make My Controller Function DRY
I have the following controller function. What I want to do is make this function do less. Most of this code is just random checks on various things that is also done on most of my other controllers. ...
0
votes
1answer
83 views
Segmenting My Code
I'm reviewing my code and trying to figure out how I can do some simplifying to flatten my code. Whether it be making simpler function out of the segment of code or by removing parts of it and wanted ...
-1
votes
1answer
62 views
Wondering why I'm getting infinite loop in flattened code [closed]
I'm trying to figure out with my application when I submit my login form with the jquery ajax request it runs the submit function but at some point gets into a infinite loop I think. The Unflattened ...
0
votes
1answer
107 views
CodeIgniter Model - Correct/Secure Usage?
I'm working on my first large CodeIgniter project (and one of my first MVC projects), and I want to get some feedback on the techniques I've used so far in one of my models. Here's the code:
<?php ...
1
vote
1answer
508 views
A good example of codeigniter MVC?
What is the difference between this two way and Which one is best? What do you suggest?
1.
Use of query (db) directly in CI_Controller. as:
$id = $this->input->post('id');
$query = ...
0
votes
2answers
209 views
Submit function For Login
Trying to see if anyone sees any potential flaws with this submit function. One concern is this line:
/* Not sure if this is needed
if ($this->session->userdata('failed_logins'))
{
// User ...
2
votes
1answer
392 views
How to make this PHP code more object oriented and less scripted
I am utilizing CodeIgniter's Pagination Class to implement pagination in the project.
In this project, there are 3 modules: Event,Business & Parts.
Each Module has same "view" for pagination. I ...
3
votes
2answers
238 views
Am I using MVC Codeigniter correctly?
I'm currently writing Report's system. I have about 20 different users with different access.
Am I doing it correctly? Can I improve my style of writing this code? All my reports based on the same ...
1
vote
1answer
77 views
Getting personal messages function
I'm trying to develop a better function and curious what others would suggest I do to it so that its not so robust and still accomplish what I need.
A couple of things I need to account for is when I ...
2
votes
1answer
515 views
CodeIgniter nav/menu insecurities
I more or less asked the same questions on stackoverflow.com, but maybe this is more for this forum. I have a hard time getting to grips with how to implement a top navigation (common for the whole ...
3
votes
1answer
776 views
Codeigniter active record - prepared statement assistance
I understand that I should use prepared statements to prevent sql injection. Unfortunately, having read the php docs on the matter I am none the wiser. Here is one of my simple active record sql ...
2
votes
1answer
57 views
Is having preset queries prone for disaster?
Edit Just did some further reading around the website and have come to the conclusion that this method leads to Leaky Abstraction, sorry for wasting peoples time. Time to head back to the drawing ...
1
vote
0answers
59 views
Is this a sensible form iteration pattern for a web form with an unknown number of fields?
I'm designing a small intranet-based time-tracking web app that accepts an unknown number of data "rows" which each consist of 7 form fields. Rows can by dynamically added by the browser.
Can I do ...
1
vote
2answers
487 views
Controller for an Administrator User, can this be improved? (codeigniter)
I want to write better code.
This is a simple controller class for an administrator login.
Are there conventions or tips in PHP to rewrite this code and improve it?
<?php
class Administrators ...
2
votes
3answers
485 views
CodeIgniter AJAX messages submission security issue
I have a small social networking site built in CodeIgniter. Any registered user can send messages to others by visiting their profile.
Today I noticed that one user sent bulk messages to 200 users. ...
0
votes
1answer
373 views
Login Controller
Here's one more controller I'm trying to get reviewed for. Any thoughts?
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Login extends CI_Controller {
public ...
0
votes
2answers
136 views
Evaluating My Code
I'm just trying to see if there's a better way to write the code i between the aestrick characters.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Activate ...
2
votes
1answer
2k views
Where to put menu items in MVC with PHP ? Model or controller?
This is my first attempt with MVC and I almost get it but a small thing bothers me.
I have this controller in CodeIgniter:
<?php
class Page extends CI_Controller {
public function ...
1
vote
1answer
154 views
Codeigniter vote routine review
I have a model that I've created in Codeigniter to represent a vote. The purpose of the site that it's a part of is to allow users to vote on their preferred pronunciation for a given word.
The ...
1
vote
1answer
1k views
Handling session resources in MY_Controller with Codeigniter
I've added a function that checks if the user is trying to use/access something which requires a session. I'd love to hear some criticisms of my choice of design.
class MY_Controller extends ...
1
vote
1answer
339 views
Updating Old Code Into Code Igniter Use
I used this code on my own site and now trying to transfer it to my new site which uses codeigniter. I'm not sure how I can eliminate some of this code and still maintain its purpose and functionality ...
3
votes
1answer
123 views
Personal Messsage Model
I'm just wondering how my model looks. And by this I mean did I perform the correct tests with the results on each function and use the return at the right points. If you can check all functions. I'm ...
0
votes
1answer
96 views
is magento architecture useful for more smaller applications?
Hi I realy like how magento creates it's view. It's not standart MVC like Codeigneter or Ruby on Rails. Magento has Block and Template.
So I have created an architecture like this.
I have layouts ...
0
votes
1answer
225 views
How to write a cleaner code for this piece of php snippet?
I would like to know if there is a better/shorter/cleaner/resource saving method for this snippet of php code with codeigniter? Thanks.
$code = $this->uri->segment(3);
if (!$code) {
// ...
2
votes
1answer
1k views
Is this good login process in CodeIgniter?
I'm creating my first login process in CodeIgniter. I'm using the simpleloginsecure library for actual session management but I wrote the controller and model myself and I was hoping if you could see ...
2
votes
1answer
139 views
Controller method optimization
I have the following function for validating users facebook information against the rules setup in the database for users. Its working fine but i need to know if it can be more optimized. Few things ...
2
votes
2answers
997 views
Codeigniter Model Optimization
Hey guyz i have created this model for codeigniter. Its working fine but i need to know if it can be more optimized. Sorry about my grammar english is not my native language.
class ...
1
vote
2answers
1k views
Mutlilevel page list in CodeIgniter
I'm newly working with CodeIgniter and PHP. I wrote a category structured 'pages' code with listing pages as multilevel list or indented select box.
page ...
5
votes
2answers
345 views
Way to optimise this PHP code?
I would like to optimise this code. It seems a bit verbose, particularly with the 'elseif' that doesn't do anything.
This code either:
takes a plain text password, generates a salt, and returns ...
3
votes
2answers
2k views
Forgotten password logic
I'm just trying to see if anyone disagrees with the way I'm handling my logic for this. Something doesn't feel right with it but I don't quite know what it is.
Just wanted to add that the ...
3
votes
3answers
1k views
Login Validation
I'm hoping someone is willing and can take a minute to look over this function and tell me what they think of it, if it can be improved or what not. I tried commenting out what the purpose of ...
3
votes
3answers
386 views
How to make this code more readable
This is a page that allow user to do register:
<?php echo form_open('user/valid_register_page', 'autocomplete="off"');?>
<?php ...
3
votes
3answers
228 views
How to simplify my code
Here is the code:
I have 3 objects, and 3 model. The note, have many tags, and every tags must have one note. So, I have a note_tag_list to store the tags and notes relationship.
The program is ...
3
votes
2answers
265 views
database design for an online learning application
It is an online learning application with different types of learnable items, that different users learn.
The users learn by spaced repetition (once right, wait a couple days, ask again), success is ...
5
votes
2answers
878 views
Critique My Codeigniter Custom CMS Pages Model
I am currently developing a custom CMS being built on top of Codeigniter and was wondering if you can spot any flaws in my page fetching model code. The page fetching model is not entirely complete ...
13
votes
3answers
6k views
CodeIgniter Active Record Subqueries
I use CodeIgniter at work, and one of our model files had a lot of subqueries in it. I originally had to manually write each subquery, and wondered if I could use active records instead.
So, to make ...