codeigniter

Remembering CodeIgniter form_dropdown fields

This works... form_dropdown('location', $location_options, $this->input->post('location')); But when I try and use an array to add extra attributes, it stops working... Why is this? $attributes = array( 'name' => 'location', 'id' => 'location' ); form_dropdown($attributes, $location_options, $this->input->post('location')); ...

Problem with Codeigniter and Doctrine, migrating from Windows to Linux server

Hi, I’ve recently been learning how to use both Doctrine and CI and have been overhauling my website using both tools… all has been absolutely awesome up until the following issue(s) occurred: Essentially it would seem that either PHP, CI or Doctrine can’t find my Base classes unless I explicitly require/include them in the correspondi...

Get valule regular expression

I have this regular expression: company/(.*)-f(\d+).html$ company/view/$2 In view method of company class I use $this->uri->segment(3) to get the value of $2; I can't understand why can't get the value of $2 just like variable. public function view($param) { echo $param; // no value returned $this->uri->segment(3) // works fine }...

Codeigniter security

I have been wondering how secure a codeigniter setup is. Because information like db passwords etc is stored in config files in the main application folder could this be retrievable by hackers? I know you can move the application folder to a location away from the web root but is it still safe if you don't? Also, even if you did move it ...

Query not work in CodeIgniter

function menuName () { $this->viewData['page_title'] = "ContentManagement Systemt!"; $this->db->where('visible', 1); $this->db->order_by("position", "ASC"); $query = $this->db->get('subjects'); $subjects = $query->result(); foreach ($subjects as $subject) { echo $subject->menu_name ."<br />"; ...

Need Time-Efficient Method of Importing Large CSV File Via PHP Into Multiple MySQL Tables

Okay, I'm having some serious issues here. I'm new to this site, and new to dealing with importing CSV data via PHP, but I'm not new to programming. Currently, I'm working on building a Customer Relationship Manager. I need to create a script to import a file that will populate the database with leads. The main issue here is that the Le...

Problems reading an RSS feed with SimpleXML

I am trying to read a simple Twitpic rss feed but not having much luck. I can't see anything wrong with my code, but its only returning the following when using print_r() Array ( [title] => SimpleXMLElement Object ( ) ) Here is my code: function get_twitpics() { /* get raw feed */ $url = 'http://www.twitpic.com/photos/Sheal...

Searching multidimensional array for values, then outputting other values in array

Hi all, I'm wondering how I might go about searching the array below for the key problem_id and a value equal to a variable which I would provide. Then, when it finds an array with a the matching key and variable, it outputs the other values in that part of the array too. For example, using the sample data below. How would you recommen...

How to create two parent controllers in Codeigniter?

I want to create two parent controllers: one for admin and one for user site. They have to extend a regular Controller class but each of them has to do different things. ...

Prevent url with a directory from pointing to a web page.

I have a domain let's call it newsite.com which is parked to maindomain.com. I use mod-rewrite to direct all requests for newsite.com to a subdirectory on maindomain.com. On newsite.com I have CodeIgniter installed. Which means the urls look like this: newsite.com/products/shoes/ The above works just fine. However, if I set up a con...

Codeigniter Routing Settings for Tank Auth

Hello, I'm using Tank-Auth for my application. And the only problem I have is activating and resetting passwords for accounts. For login, register, logout; I have no problem with this codes; $route['login'] = "/auth/login"; $route['logout'] = "/auth/logout"; $route['register'] = "/auth/register"; But for activating accounts and rese...

Building wiki like functionality

Hi, I am building my application in Codeigniter. It has a module where users create documents, which can be edited at a later time. How do I implement a 'history' of revisions, perhaps like a wiki ? Is it possible to embed a php wiki in a web app (twiki/dokuwiki)? ...

Prevent SQL injections in codeigniter

In my project I use $this->input->(get|post) to pass data to models. In models I always use active records. Is this enough to prevent sql injections ? ...

Code Igniter Views Remember Previous Variables!

I have the following code in a Controller: $data['what'] = 'test'; $this->load->view('test_view', $data); $this->load->view('test_view'); View: <?php echo $what; ?> The Result when running this code is: testtest Shouldn't it be simply 'test' because the second time I am not passing the variable $data? How can I make CodeIgn...

How to include javascript script links to pyrocms page?

I'm using pyrocms to develop a system. I know that, to include style links in header tag '' in a page is by using $this->template->set_metadata(). But how can I include javascript links like that? Any answer is appreciated. ...

Codeigniter and Multiple Inheritance?

Wondering if this is even possible or a limitation of PHP, googling around seems to be the case but maybe I'm missing a clever solution here. Hopefully this will make sense. Right now I have two portions to my site, an admin and client side. I have been able to split it into two controllers(admin and client) that inherit from a base M...

How to hide index.php from Url by htaccess

With respect to Code Igniter And MySql: How to hide index.php from Url by htaccess? ...

Apache mod_rewrite usually works, but won't work in this folder -- what's wrong?

I have an Apache web server that usually handles mod_rewrite fine. I have a directory called /communications/q/ and I want to rewrite any URI to insert "index.php" before the rest of the entered URI. For example, /communications/q/something/else should actually serve communications/q/index.php/something/else. It's the standard PHP CodeI...

Pass a PHP string (which represents a JS function) through json_encode()

I'm using this PHP/CodeIgniter library for jQuery Highcharts: http://www.crustiz.com/php-jquery/highcharts-library-for-codeigniter/ The way that library does things is that it builds a PHP array of options, then converts it to json using json_encode (see line 273 of that library) which is then used by the jQuery Highcharts plugin. This ...

Setting test items in CodeIgniter Unit Test not effecting report output

I'm running CodeIgniter 2.0 and I have a test controller setup with this code in the index function. It seems like no matter what I put in the "set_test_items" variable, the report never changes. It always show all of the possible information regarding the test. I feel like I must be missing something blatantly obvious here. What am I mi...