codeigniter-2

CodeIgniter Active Record For Joining The Tables

非 Y 不嫁゛ 提交于 2019-12-10 15:44:22
问题 I've following tables. apartments id name slug created modified apartment_amenities id name slug apartment_id created modified apartment_activities id name slug apartment_id created modified In the view I wanted something like this. no apartment_name amenities activities 1 shobha_comnplex party hall pamplets swimming pool banners play area boards 2 navami_comnplex party hall boards swimming pool banners club house pamplets In the model I tried like this. $this->db->select('apartments.id,

Library as Singleton in Codeigniter?

廉价感情. 提交于 2019-12-10 15:42:37
问题 I've created a custom library using singleton pattern. Why by this way? because I need to be able to call my functions without $this-> reference, for example, I could execute the code below: function foo() { MyLibrary::instance()->foo(); } then I could call my functions in controllers like this: function foo(); instead of $this->mylibrary->foo(); I am in trouble because CodeIgniter try to instantiate my library when the best way to do is "read" the static instance. Why I need to do this? My

using angular js get data from codeigniter controller

穿精又带淫゛_ 提交于 2019-12-10 12:18:20
问题 I work with codeigniter with angular js. I had created one controller name Car.one model name car_model. In car controller i have created one method view () in which i am fetching data from the table that code file is Car Controller <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Car extends CI_Controller { public function __construct() { parent::__construct(); $this->load->model('Car_model'); } public function view() { $data = $this->db->get("cars")->result

codeigniter :load view inside div of a view

可紊 提交于 2019-12-10 12:09:59
问题 lets say that i hv this view (main) <body> lorem epsim <div table></div> lorem epsim </body> in controller control1.php i do $this->load->view('header'); $this->load->view('main',$data); $this->load->view('footer'); Now i need to load content of div=table from another view (tbl.php),which is called from another controller control2.php function load_table(){ $data['x']=1; $this->load->view('tbl.php',$data); } tbl.php view <ul>$x</ul> how can i do that ? i tried to load controler 2 from

Disable sandbox mode for Paypal Express

↘锁芯ラ 提交于 2019-12-10 11:59:05
问题 I'm using Omnipay with CodeIgniter to allow customers to checkout on Paypal. I was using test mode during the development on the website, but now the site is done and ready to be put in production. But I don't know how to setup Omnipay to use live payments and not Sandbox mode. I tried setting the testMode to false. -> Security header invalid. I tried creating REST Api credentials -> You can't make this api call. I know that's probably not the right way to do this, but at least I explored

codeigniter csrf protection error with ajax

六月ゝ 毕业季﹏ 提交于 2019-12-10 11:49:54
问题 i have a small problem here which i cannot fix,This post goes through but the response returns a “500 internal server error” who to fix it? after search in CI forum i found this this link codeigniter-csrf-protection-with-ajax but i cant solve by it.can any one help me? 回答1: You should include the csrf key in your AJAX POST request to get the action to work. However, you're only GETTING data, so using method:'get' instead of method:'post' should do the trick and make your request work. See

Special characters with dompdf and php

我的梦境 提交于 2019-12-10 11:47:39
问题 I have a question: I tried to export a pdf with dompdf and php but I can't do this and I dont understand where is my problem, so my code is: public function generateTitlePage($company) { $this->load->library('dompdf_gen'); $html=' <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </head> <body> <div style="margin-top:20px;text-align: center;font-weight: bold"> Company:'.$company.' </div> </body> <html>'; $dompdf = new DOMPDF(); $html = stripslashes($html);

CodeIgniter session timeout issue

旧巷老猫 提交于 2019-12-10 11:43:20
问题 I’m using CI 2.1.4 and I set $config['sess_expiration'] = 0; but sometime when I’m in my dashboard I’m unlogged automaticaly by the site… The context is the following : I’m using 2 applications for 1 system, but both applications use the same encryption key, session table and the same timeout. This problem appear when I submit a form then after I pick up session data to add it in the database. Anyone has an idea ? Thanks. 回答1: I think you have 2 ways to fix it. First, you should download

Codeigniter update_batch() with included update of the where key

[亡魂溺海] 提交于 2019-12-10 11:09:24
问题 I want to update multiple rows in the database with codeigniters update_batch() function. But the field specified in the where should also be changed. The following code should make it clear: $set = array( array( 'token' => '65787131678754', 'device' => 'none', 'new_token_value' => '' ), array( 'token' => '75798451315464', 'device' => 'none', 'new_token_value' => '' ) ); $this->db->update_batch(TBL_NAME, $set, 'token'); Tokens specified in token should be updated with device to 'none' and the

CodeIgniter PDO driver uses query instead of prepare? Isn't this less secure?

无人久伴 提交于 2019-12-10 10:51:44
问题 I am new to the CodeIgniter framework for php and was looking at the PDO database driver with Version 2.1.0. I noticed it uses the PDO 'query' function and not 'prepare' and 'bindParam'/'bindValue'. Doesn't this completely miss the point of using PDO in the first place and in fact make it less protected from sql injection than using the normal mysql driver they provide. It doesn't seem to be escaping queries like it does with the other provided drivers? Or am I completely misinterpreting