codeigniter

Building REST APIs code Igniter

 ̄綄美尐妖づ 提交于 2019-12-23 20:44:30
问题 I am trying to develop REST APIs for my website. I am using CodeIgniter's PHP Framework. I have followed the tutorial mentioned on http://code.tutsplus.com/tutorials/working-with-restful-services-in-codeigniter-2--net-8814 to create the restful apis. The tutorial is based upon the code developed on https://github.com/chriskacerguis/codeigniter-restserver I have placed the rest.php in application/config folder and REST_Controller.php in application/libraries/ I have created an api in

Defining a Root Path

此生再无相见时 提交于 2019-12-23 20:36:27
问题 I'm looking for a way to define a config variable as being the root path of my website. What's the nicest way to define this. I am using Codeigniter. $config['root_path'] = ? This is for my site_config file in my config folder. / /dev /dev/application /dev/application /dev/application/config /dev/application/config/site_config.php /dev/system/ /dev/assets/ /public_html 回答1: I think $config['root_path'] = $_SERVER['DOCUMENT_ROOT']; will give you what you're looking for, regardless of which

Codeigniter links not working without index.php in url

纵饮孤独 提交于 2019-12-23 20:35:53
问题 I developed one web application in which I used codeigniter, Structure of all the URLs of my web application is as follows: <?php echo base_url();?>/Admin/Promotions this type of links are working well in my Localhost but not working on my hosting server ( I'm using Godaddy hosting ) But some links which have index.php in URLs are working both on localhost and server too structure of this king of links are <?php echo base_url();?>index.php/Admin/Pramotions What shoud I do so that URLs without

extra newlines in plain text emails sent via sendgrid

纵然是瞬间 提交于 2019-12-23 20:32:41
问题 We send emails in plain text from PHP using CodeIgniter (v1.7) and also PHPMailer (v5.1). Current production setup uses a cheapie SMTP relay, plan is to switch to a CritSend or SendGrid. We are testing the options now from a Rackspace Cloud server. When we use SendGrid SMTP all "\r\n" newlines in the emials end up being doubled up, so end up as "\r\n\r\n". All works fine when using CritSend SMTP and also two other SMTP servers. SendGrid tech support don't think it is anything to do with their

Modal not loading using javascript in php(CodeIgniter)

心不动则不痛 提交于 2019-12-23 20:14:51
问题 I want to open model on successful submission of form but although form is submitting modal is not popped up. public function insert($data) { // Inserting into your table // Calling model $done = $this->db->insert('sign_up', $data); if($done) { echo "<script>$('#thankyouModal').modal('show')</script>"; echo '<div class="modal fade" id="thankyouModal" tabindex="-1" role="dialog"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class=

adding user id from database to session data in Codeigniter?

笑着哭i 提交于 2019-12-23 19:58:26
问题 i am new to CodeIgniter and facing problem in adding user id(after user has logged in) from database to session data here is my code question may be asked before on SOF , after putting all my efforts i am asking this //login-model <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Login_model extends CI_Model { function __construct() { // Call the Model constructor parent::__construct(); } //get the username & password from tbl_usrs public function get_user($usr,

Solution to multi server environment with a CodeIgniter website

筅森魡賤 提交于 2019-12-23 19:53:29
问题 I have a local, staging and production environment for my CodeIgniter based site. Increasingly I find everytime I deploy a version I have more and more little bits of code to change because of server variations. What would be a good (and quick) solution I could add that would allow me to set these variables by just using one setting. Where would be the best place to insert this in the index.php, some sort of hook? 回答1: define a "LIVE" constant which is TRUE or FALSE based on the current

Session Timeout in codeigniter dyanamicly

北城余情 提交于 2019-12-23 19:49:18
问题 I have issue regarding codeigniter Timeout . I know the config folder setting session timeout manually like as l $config['sess_expiration'] = 123; but i need to the website admin manage the session time out dyanamicly in to the admin page please help me how to implement this logic i tried this logic but not working $this->session->sess_expiration = "120"; Note:here i am storing database in the value. based on the database value i can set in to the session expiration time note 1: $config['sess

Codeigniter 404 Error On Live Server

偶尔善良 提交于 2019-12-23 19:42:11
问题 i changed my controller name from controller.php to Controller.php also changed my base_url in config file to the directory where my website is hosted like www.abc.com/websitefolder but still i am getting 404 error website url : www.cyfers.com/moving/ my base_url : $config['base_url'] = 'http://www.cyfers.com/moving/'; my .htaccess code RewriteEngine on RewriteBase / RewriteCond $1 !^(index.php|resources|robots.txt) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d

How write a new file in codeigniter?

安稳与你 提交于 2019-12-23 19:40:04
问题 First I want to load a view file into a variable, then I need to create a new file by writing the data to new file.ie,Like creating a copy of a view file. $vPath = "home/muhammed/desktop/newfolder"; $ViewData=$this->load->view('test/show',TRUE); mkdir($vPath); write_file("$vPath/test.php", $ViewData); But the code given is not working. 回答1: change: $ViewData=$this->load->view('test/show',TRUE); to $ViewData=$this->load->view('test/show', "", TRUE); as second parameter of load->view is data