codeigniter

Generating PDF with DOMPDF with codeigniter on button click after submission of data in to database

时光毁灭记忆、已成空白 提交于 2019-12-25 12:55:30
问题 I have a question regarding PDF creation with DOMPDF. Basically I have a form that submits data to a DB with jquery that looks like below $('#submit').click(function(){ var submit = $.ajax({ url: 'setController.php', type: 'POST', data: dataString, success: function(msg){ alert("sent"); }, error: function(msg){ alert("fail"); } }); }); The setController calls my setModel which returns a render of my html after it has submited the data in to the DB. Which looks like this. $html = $this ->

MongoDB Trying to call User logged Rest API Call but facing issue

為{幸葍}努か 提交于 2019-12-25 12:54:54
问题 I am trying to call User Logged API Call for MongoDb but faced following issue. BackEnd: CodeIgniter Parse Rest API Call to connect MongoDB. _UserArray ( [code] => 102 [error] => Improper encode of parameter ) Fatal error: Uncaught exception 'ParseException' with message 'Improper encode of parameter' in /Applications/XAMPP/xamppfiles/htdocs/icymi/application/libraries/Parse/ParseClient.php:264 Stack trace: 0 /Applications/XAMPP/xamppfiles/htdocs/icymi/application/libraries/Parse/ParseUser

Codeigniter routes not working sometimes

佐手、 提交于 2019-12-25 12:43:16
问题 I have a little question. I am using Codeigniter 2.1.0 and I have the following code in my routes.php. $route['default_controller'] = "photo"; $route['404_override'] = 'error'; $route['photo/:num'] = 'photo/index/$1'; $route['people/:num'] = 'people/index/$1'; The weird thing is, sometimes when I go to http://www.myurl.com/photo/1 it works and othertimes it redirects me to my error page. Anyone maby has any idea what is wrong with my routes ? Already thanks in advance! Bob 回答1: This is not

calling nested function php codeigniter

自古美人都是妖i 提交于 2019-12-25 12:11:12
问题 i am trying to call a function which is nested under other function consider a example: function _get_stats() { function _get_string() { $string = 'Nested Function Not Working'; return $string; } } public function index() { $data['title'] = $this->_get_stats() . _get_string(); $this->load->view('home', $data); } now when i run the page in web browser blank page is displayed. any suggestion or help would be a great help for me.. thanks in advance 回答1: The function is not really nested, but

Codeigniter Form Validation Setting Strong Password Validation Rule In an Array

无人久伴 提交于 2019-12-25 12:05:35
问题 I am using codeigniter form validation to validate user data when creating new user. I want to add some sort of password criteria for example password must have at least one capital letter, a number, and one of !, @, #, $ etc) and there have to be 6-25 characters. This is the array that I am using for validation rules: $config = array( array( 'field' => 'title', 'label' => 'Title', 'rules' => 'trim|required' ), array( 'field' => 'firstname', 'label' => 'First Name', 'rules' => 'trim|required

Is it possible to have dynamic RewriteBase on .htacess?

亡梦爱人 提交于 2019-12-25 11:53:46
问题 I made a CodeIgniter based website. I write a .htaccess as suggested in http://codeigniter.com/wiki/mod_rewrite Since I put my web directory in public_html/ci_try, It is necessary to change RewriteBase / into RewriteBase /ci_try But, everytime I change the location, I should edit htacess. Is there a way to make such a "dynamic rewrite-base" or other way so that I don't need to repeat my self editing htaccess? UPDATE : For now I use php to generate htaccess. But I want to know if there is a

Codeigniter common templates

不想你离开。 提交于 2019-12-25 11:52:34
问题 Let's say that I have a website that has 100 different pages. Each page uses a common header and footer. Inside the header is some dynamic content that comes from a database. I'd like to avoid having to have code in every single controller and action that passes this common code into the view. function index() { // It sucks to have to include this on every controller action. data['title'] = "This is the index page"; data['currentUserName'] = "John Smith"; $this->load->view("main_view", data);

Message: Undefined variable: in View page

孤者浪人 提交于 2019-12-25 11:50:52
问题 I am still new at PHP and the MVC concept. I have been trying to duplicate the CI News Tutorial(http://codeigniter.com/user_guide/tutorial/news_section.html), while using my own database and rewriting the code. I have been unsuccessful. Here is my controller: class Main extends CI_Controller { public function __construct() { parent::__construct(); $this->load->helper('url'); $this->load->library('tank_auth'); $this->load->model('structures_model'); } public function structures() { $this->load

There are some unexpected errors in form validation in codeigniter 3

爱⌒轻易说出口 提交于 2019-12-25 11:13:08
问题 I am making 2 step registration. I have done the first step, now I am doing the second one. I want to make ajax form validation, but it gives the error right away opening the page and the error is at the top of page Also pressing submit button it gives no errors despite empty fields. Here is my view: <div id="messages"></div> <?php $attributes = array('class' => 'rex-forms', 'name' => 'continueregistrationform', 'id' => 'continueregistrationform'); ?> <?= form_open_multipart('user

Set a variable value in one function and use in other functions, when called directly from link in codeigniter

扶醉桌前 提交于 2019-12-25 10:02:22
问题 I've tried a lot but I am not getting my requirement. I have a controller in which I declared a private var and assigning this in one of the function of the controller. Then I want to use it in another function when called from a link directly that function. class Xyz extends CI_Controller { private $var; public function __construct() { parent::__construct(); $this->var = null; } public function getGenVal(){ $this->var = $_REQUEST['value']; //Setting the global variable } //Calling bellow