codeigniter-2

CodeIgniter - Simple base_url question

自作多情 提交于 2019-11-27 07:40:07
问题 I'm a bit confused here. I have a simple controller which loads a view. The view contains a form and links some CSS files. I don't really want to do ../../css/global.css in my link tag. I want to use the base_url() method and then go /css/. I know a friend uses the following: <link href="{base_url}css/style.css" rel="stylesheet" type="text/css" /> However, I can't get that to work. He uses CodeIgniter 1.7 though, I'm using the latest (2.something) version. I'm new to CodeIgniter and I wanted

Reports in Codeigniter

隐身守侯 提交于 2019-11-27 06:56:06
What is the most simplist way to generate reports in Codeigniter framework? Is there any library available to do this task? Except charting what are the other resources to do this. Found a nice solution myself. If you want to generate reports in csv format it is very easy with codeigniter. Your model function function index(){ return $query = $this->db->get('my_table'); /* Here you should note i am returning the query object instead of $query->result() or $query->result_array() */ } Now in controller function get_report(){ $this->load->model('my_model'); $this->load->dbutil(); $this->load-

Codeigniter Setting Homepage ( Default Controller )

自作多情 提交于 2019-11-27 06:12:19
问题 I'm trying to implement page templating in my codeigniter application, templating is working fine for instance, i have a blog page, which i'm trying to assign as my homepage, with different view and pagination and so on. When i write www.mywebsite.com/blog, it gets opened in homepage template, or assume that i have a page www.mywebsite.com/about , it gets opened in page template too. But when i try to access my website via www.mywebsite.com, i have a 404 error page. How can i assign my blog

escapeshellarg() has been disabled for security reasons

梦想的初衷 提交于 2019-11-27 05:28:38
When I want to upload anything in any form I see the Warning: escapeshellarg() has been disabled for security reasons message on my site. What can I do to fix this? My framework is codeigniter final version. Here is the full warning: A PHP Error was encountered Severity: Warning Message: escapeshellarg() has been disabled for security reasons Filename: libraries/Upload.php The @ operator will silence any PHP errors the function could raise. You should never use it! Solutions: Remove the escapeshellarg string from the disable_functions in php.ini file Ask your host provider to remove Remove the

Routing controllers in subfolders using CodeIgniter

送分小仙女□ 提交于 2019-11-27 05:15:10
since i want to separate the frontend and backend of the system. i have created 2 folders inside controllers as frontend and backend Below is the structure of my controller folder controller --frontend ---store.php ---processing.php ---profile.php ---authenticate.php ---register.php --backend ---authenticate.php ---stats.php ---users.php ---property_manage.php ---register.php i can access the functions by using frontend/store/add frontend/store/manage ...... backend/stats/sales backend/stats/payments ..... but i want to take off the frontend and the backend segments from the url. I checked the

CodeIgniter: How to get Controller, Action, URL information

我的未来我决定 提交于 2019-11-27 05:03:24
问题 I have these URLs: http://backend.domain.com/system/setting/edit/12 http://backend.domain.com/product/edit/1 How to get controller name, action name from these URLs. I'm CodeIgniter newbie. Are there any helper function to get this info Ex: $params = helper_function( current_url() ) Where $params becomes something like array ( 'controller' => 'system/settings', 'action' => 'edit', '...'=>'...' ) 回答1: You could use the URI Class: $this->uri->segment(n); // n=1 for controller, n=2 for method,

Where do I put image files, css, js, etc. in Codeigniter?

早过忘川 提交于 2019-11-27 02:33:01
Where is it acceptable to put css folders and image file folders? I was thinking inside the view folder? However the controller always reroutes the path to the base url so I have to specify the path in the .html file to where it sits, which is redundant. Eddie I have a setup like this: application system assets js imgs css I then have a helper function that simply returns the full path to this depending on my setup, something similar to: application/helpers/utility_helper.php: function asset_url(){ return base_url().'assets/'; } I will usually keep common routines similar to this in the same

combining mysql AND OR queries in Codeigniter

拈花ヽ惹草 提交于 2019-11-27 02:03:53
问题 I want to combine AND OR mysql queries in CI. I have already seen this thread: http://codeigniter.com/forums/viewthread/92818/. But they don't provide the exact solution there. How do I create the following query using strictly the CI framework? (I can create the query easily without the brackets but then it is not the same query.) SELECT * FROM `Persons` WHERE LastName='Svendson' AND Age="12" AND (FirstName='Tove' OR FirstName='Ola' OR Gender="M" OR Country="India") P.S.: This is just a

CodeIgniter 2.1 issue with show_404() and 404_override

故事扮演 提交于 2019-11-27 01:21:08
问题 I have been working with CodeIgniter for quite a while now and I'm currently doing a project for a client that would like a custom 404 page. Everything is fine and the 404_override it works great. My issue comes when a visitor is trying to access a article that do not exist I would like to call the show_404() function, but this shows me the "out of box" 404 page and not the one written in the 404_override. I have seen some fixes for older versions, but I can't get it to work in 2.1 . So if

Is there a function like _compile_select or get_compiled_select()?

拟墨画扇 提交于 2019-11-26 23:21:32
问题 Looks like _compile_select is deprecated and get_compiled_select is not added to 2.1.0. Are there any other functions like those two? And also I am curious. Is there any particular reason to not adding get_compiled_select() to Active Record and removing _compile_select ? 回答1: I've added get_compiled_select() to DB_active_rec.php and it seems to work without problem, but i wouldn't remove _compile_select() since it's used in many other methods. The pull request for adding this method is here,