codeigniter

how can i make variable declaration optional in codeigniter?

coming from a modular php programming environment i got used to using variables in php without regard of wether they were instantiated or not. i've been using codeigniter for around a month now and noticed that it is strictly implementing on not using a variable if they are undefined / undeclared. i would like to know what's the purpos...

"SELECT TOP 1" equality for codeigniter?

Hi Friends, I need to get only 1 record from sql result. we use "SELECT TOP 1" in standard sql, but how can we do that in CodeIgniter? Is there any func for that? I researched so much on net, but could not find :/ appreciate! thanks, ...

codeigniter simplepie

hey, I wanted to mention, i have simplepie working in my development environment but as soon as I uploaded the site I cannot get feeds into my homepage. Any ideas? here is the code that works on localhost: function Homepage() { parent::Controller(); $this->base = $this->config->item('base_url'); $this->css = $this->config->ite...

accessing lang variables from controller + codeigniter

Hi Friends, How can I access my lang variables in controller? function index() { $seo_title = $this->lang->line('blablabla'); $data['page_title'] = $seo_title; $this->load->view('contact/index.php',$data); } in my lang file blablabla has string in, and it works well when I call from view file. but when I want to call fro...

codeigniter site, swfobject not fully loading swf

I am having a strange problem. I have a view that is supposed to load a swf. The swf was compiled with Flex and the mxml preloader displays but it loads a blank screen. When I path directly to the file it loads fully and works fine. Other possibly relevant information: The swf makes calls through GET requests to the database the si...

fancybox jquery codeigniter

hi, I have a small situation. I am preparing a sample for a client and I cannot understand this. I have a div with 7 jpg's and a list item that is a link that if I click should fireup fancy box and show some pics in gallery format. Now this doesn't work so I remembered that I must add the '#' to the list of accepted characters in ci but...

how do you concatenate to array items to create a new one and add it back into the same array (code Igniter)

Hi I have a query which returns a series of cells of data from a $this->db->query($sql) in the controller. What I want to do is foreach row of data, concatenate two of the cells and create a new cell then add it back to the array? For example, if i had an array: A 1 B 2 C 3 Then we can after processing the array A 1 A1 B 2 B2 C 3 C3...

Escaping data for use within a CodeIgniter View

I have a controller and a view; the data that I'm working with inside the controller can't be trusted (it's drawn from somewhere external, and isn't $_GET or $_POST). How do I escape the data when printing it in the view to ensure that tags and other things are escaped properly? I'm used to Zend_View's $this->escape($foo), which is used...

snow leopard, mod_rewrite, codeigniter

hay guys, i'm having all sorts of mod_rewirte trouble in snow leopard. Anyone know any decent articles focused on snow leopard and mod_rewrite? Or perhaps a simple step by step guide. What i want to do is setup codeigniter so the urls looks 'pretty'. so localhost/~myusername/ci_app/index.php/mycontroller/myaction would become local...

codeigniter image uploading mysql

hi, I wanted to know if I was uploading an image in codeigniter to a database what would be my $config['upload_path'] all the examples I have seen are using the filesystem. I have articles in a db and would like to store images relating to articles in the db as well. Can anyone help? ...

Extracting words from text field in SQL

Hi, I'm currently building a little CMS for a smaller site. Now I want to extract all words from the text_content field and store them in my word table for later analysis. page( id int, title varchar(45), # ... a bunch of meta fields ... html_content text, text_content text); word( page_id int, # Forei...

CodeIgniter: Unknown column xxx in ‘where clause’

Hello There, I am working on a bug(?) for a few hours now, but couln’t fix it. This is my code: if(!$this->db->get_where('merken',array('m_merken' => $brand))->count_all_results()){ $insetData = array('m_name' => $brand); $this->db->insert('merken', $insetData); } $brand contains ‘Acer’ in this preview. A Database ...

codeigniter url

Hello guys, sorry but something wired is happening to me i thought I should share. everything works fine in my CI install doing local development but i noticed that if I for example clicked on link with value of href being “controller/function” everything works fine. if i try to navigate to another page(essentially to another function i...

Codeigniter Table Generation With links Question

I have data coming from my model into this Controller function index() { $this->load->model('work_m'); $data = array(); $config['base_url'] = base_url().'index.php/work/index/'; $config['total_rows'] = $this->db->count_all('work'); $config['per_page'] = '10'; $config['full_tag_open'] = '<p>'; $config['full_tag_close'] = '</p>';...

MySQL Order by math

Hello There, I want to order a result by fieldx * fieldy, for example: Row 1: fieldx = 10 fieldy = 10 Total: 100 Row 2: fieldx = 11 fieldy = 5 Total: 55 Row 1 has to appear first. Couldn't find anything about it. It's for a codeIgniter project, so if there is a solution with that I'm very happy. Thanks! ...

How do I access an MVC function via a cron job?

Hi, I'm using CodeIgniter (a PHP framework) to build an app, and I have an every-minute job to run with the program, 24 hours a day. I currently have it set up as: example.com/controller/runthis and that executes the job I want, but cron doesn't visit the URL as a user, it executes a script as far as I know. Do I just write a script ...

Break out shared model in code igniter applications

Hi, I'm fairly new to code igniter and to php (coming from a java background). I want to create a model that's shared by three apps that may or may not run on the same machine. So I want to keep the model classes portable to be shared by all three and easily handled by SCM systems. So my thought was to do the following: If I have alrea...

Sending XML data using HTTP POST with PHP

I need to send this XML <?xml version="1.0" encoding="UTF-8"><gate><country>NO</country><accessNumber>1900</accessNumber><senderNumber>1900</senderNumber><targetNumber>4792267523</targetNumber><price>0</price><sms><content><![CDATA[This is a test æøå ÆØÅ]]></content></sms></gate> to a SMS gateway service. The service listens for HTTP ...

CodeIgniter: Simple URL routing question

I'm new to CI and URI routing in general. I created a new app. Set the default controller to Main. In Main, I have an index method, a popular method and a recent method. When I load my app, the url shows up as http://localhost/myapp... this obviously loads up the index method in the Main controller... that's fine. Now how do I route m...

Code Igniter Function Call 404

I was going through the official Code Igniter tutorial when I hit a snag... The tutorial had me save and run this code: <?php class Blog extends Controller { function index() { echo 'Hello World!'; } function comments() { echo 'Look at this!'; } } ?> IF I enter the following URL: ind...