codeigniter

HTaccess not rerouting [CodeIgniter]

痞子三分冷 提交于 2019-12-24 09:38:49
问题 I have an application that works great when using the full url: sitename.com/index.php/foo/ but when I use HTaccess to remove the index.php it doesn't seem to work as expected. No matter which page I access I only see the home page. The htaccess file is doing something because without that line I get a 404 error. RewriteEngine on RewriteCond $1 !^(index\.php|assets|file-manager-files|robots\.txt|favicon\.ico) RewriteRule ^(.*)$ /index.php/$1 [L] Thoughts? On my test site everything works just

codeigniter hooks can't get $ci object to work

回眸只為那壹抹淺笑 提交于 2019-12-24 09:27:29
问题 I've just started looking at hooks today not 100% sure what I'm doing wrong but I'm getting an error when I try and use the $ci object in my function. A PHP Error was encountered Severity: Notice Message: Trying to get property of non-object Filename: hooks/language.php Line Number: 12 My hooks file looks like this. It's in the hooks directory in my application folder. class Language{ var $ci; public function __construct(){ $this->ci =& get_instance(); } function get_language(){ echo $this-

Delete mysql records is not working in codeIgniter

£可爱£侵袭症+ 提交于 2019-12-24 09:26:05
问题 This is my controller function: function delete_article($title){ if ($this->session->userdata('User') && $this->session->userdata('User') == 'admin@example.com') { $this->load->model('Article', 'Article', TRUE); $this->Article->delete_article_db($title); redirect('admin/user_article'); } else { redirect(''); } } And this is my model function for deleting the database record: function delete_article_db($title) { $this->db->where('Title', $title); $this->db->delete('article'); } When I run this

Access Codeigniter functions from external script

我是研究僧i 提交于 2019-12-24 09:08:07
问题 So, here's my situation : I have a complete app set up with CodeIgniter. I'm initiating a background task , running a PHP script. My question : How could I use CodeIgniter function (e.g. $this->db or $CI->db - doesn't matter) from that external PHP script? Idea : Could a workaround, like include 'index.php'; at the top of the script do the trick? 回答1: In recent Codeigniter versions you can run standard controller actions from command line. If your task is some kind of a daemon you can embed

How to add a tfoot row to table generated with codeigniter table class

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-24 08:58:46
问题 I want to add footer row to the table generated by CI table class. There are classes available which extend the table class and add this functionality. I would prefer to use native feature if available without extending the table class. Is it possible in CI table class? 回答1: I ended up putting a div under the table with similar formatting to offer an illusion of footer row. Hopefully in future the table class will include the tfoot feature. I am aware of extended classes which will add this

MVC Fundamentals: Passing work along to the view?

岁酱吖の 提交于 2019-12-24 08:57:11
问题 I'm using Doctrine2 and CodeIgniter2, and am new to both, as well as to OOP/MVC, so please use simple explanations :) For testing purposes, I have a Controller a Model and a View. I want to display data from a table that contains user information. First name, last name, ID number, and so forth. My controller makes a call to the model- which retrieves data from the doctrine entity, and then the controller passes that data to the view. (controller) class Test_v_to_m extends CI_Controller {

Redirect in codeigniter after login

扶醉桌前 提交于 2019-12-24 08:56:10
问题 Trying to do a redirect after a successful login. The login info is sent using ajax to the controller. My controller code as below public function login_controller_function() { $this->load->model('login_model'); if ($this->input->is_ajax_request()) { $user_name=$this->input->post('username'); $user_password = $this->input->post('password'); $this->load->helper('url'); $result = $this->login_model->verify_user($user_name,$user_password); // echo 'user_logged_in'; if(strcmp($result,'user_logged

Extract sentences from HTML in PHP [duplicate]

一曲冷凌霜 提交于 2019-12-24 08:49:12
问题 This question already has answers here : How do you parse and process HTML/XML in PHP? (30 answers) Closed 5 years ago . I'm doing a PHP project (using Codeigniter) on text summarization and for that I need to extract sentences from content of a Rich TextBox (this content includes tags). Therefore is there a proper method or Codeigniter library to extract sentences from a content containing HTML tags ? 回答1: A php function strip_tags() should help you. It returns string without php and html

2 codeigniter applications & htaccess

强颜欢笑 提交于 2019-12-24 08:39:02
问题 I had a codeigniter proyect working in windows with XAMPP and now I was moving it to my RaspberryPi: Apache/2.2.22 (Debian) PHP 5.4.4-14+deb7u5 mysql Ver 14.14 Distrib 5.5.31 I have two codeignitir aplications (principal and panel) with this estructure / -> (apache root folder) /appname/admin /admin/application/ -> (codeigniter application to panel) /appname/application/ -> (codeigniter application to public) Now I can't access to admin controllers and I think is because .htaccess. I get this

codeigniter - hidden input with redirect function

久未见 提交于 2019-12-24 08:38:44
问题 i made a simple form for users to add email & city for newsletter form is working fine and insert data in db, but i use two form because of english and arabic users now i need to add hidden input on both form secondly i need redirect as per the hidden input what can i do please suggest and guide me to fix this problem, for convenience i share complete codes as files. ar_signup.php in views <!DOCTYPE html> <html lang="en-US"> <head> <title>Landing Page</title> <meta charset="utf-8"> <link href