codeigniter-3

How to change the extension in view using codeigniter 3?

僤鯓⒐⒋嵵緔 提交于 2019-12-07 15:32:29
Here's my problem I setup Codeigniter 3 in my local and use an thirdparty (MX thing) now that I have adjusted the file path, I wanted to change the file extension that is being fetch the controller. $this->load->view('welcome_message'); I change the file in views from: welcome_message.php to this welcome_message.html Now I get this error An Error Was Encountered Unable to load the requested file: welcome_message.php but I wanted to use the .html extension becuase the folder path that I will be using will only contain html/js/css (template folder) files only (i will separate the php files to

Error: while login and logout using codeigniter [duplicate]

青春壹個敷衍的年華 提交于 2019-12-07 01:52:36
This question already has answers here : Codeigniter pressing logout button and disable the back browser button (4 answers) Closed last year . The login and logout is working fine but, after getting logout from the page im still able to access that page, for example in url if i use as codeigniter_try/index.php/Home/backend its displaying the page which should not happen, i mean to say it should display only when i loggedin with the username and password. what issue im facing here can any one guide me ? This is my Controller.php //-------this is Login method -------- public function login() {

Codeigniter application: how can I display pagination as JSON?

可紊 提交于 2019-12-07 01:07:29
I am working on a blog application with Codeigniter 3.1.8 . Currently, its admin area is well separated from the frontend. In the frontend, I have managed to replace "classic" Codeigniter views with JSONS. (the JSONS are displayed and "handled" with AngularJS). Here is the code in the controller for all the posts : private function _initPagination($path, $totalRows, $query_string_segment = 'page') { //load and configure pagination $this->load->library('pagination'); $config['base_url'] = base_url($path); $config['query_string_segment'] = $query_string_segment; $config['enable_query_strings']

CodeIgniter calendar to add multiple events per day?

别说谁变了你拦得住时间么 提交于 2019-12-06 15:21:25
问题 I am creating a Calendar view using CodeIgniter Calendar Library. I have multiple events per day but calendar shows only one event per day. If the day has more than one events it shows only the last event. Would appreciate if someone can help me to modify my coding below. Best regards Controller function calendar($year=null, $month=null) { $calendar = $this->timesheet_model->get_calendar($year, $month); $data = array('title' => 'Calendar | Onsys', 'main_content' => 'view_timesheet_calendar',

Codeigniter- how load new page after removing index.php

送分小仙女□ 提交于 2019-12-06 13:43:55
I am new to codeIgniter. I have some links in my index file. I have removed index.php from url so now url look like http://localhost/app/Loader/demo_page This if my Loader code: class Loader extends CI_Controller { public function __construct(){ parent::__construct(); $this->load->helper('url'); } public function index() { $this->load->view('header'); $this->load->view('center'); $this->load->view('footer'); } public function demo_page() { $this->load->view('demo'); } } When I click on this link, I get not found error. Now what should I do? I want to remove controller name also from url and

Codeigniter 3: How to use composer packages? (Twilio SDK)

試著忘記壹切 提交于 2019-12-06 12:10:16
问题 What I did so far: I am pretty familiar with CI, but new to composer and the twilio SDK. Reading some tutorials and docs I managed to install composer and the twilio package. However the /vendor folder is parallel to my CI installation: /var/www/html/ - application - system - vendor I have therefore edited the config.php setting the path like this: $config['composer_autoload'] = '/var/www/html/vendor/autoload.php'; In my controller tried to use the SDK as documented in the Twilio SDK: <?php

CodeIgniter3 - supporting both API & Web requests in Controllers?

坚强是说给别人听的谎言 提交于 2019-12-06 08:40:13
I'm currently working with a CodeIgniter3 application, and have built the basis for a standard blog-like system. The structure is standard CI - User requests a page, page loads controller method, controller method calls any relevant DB functions from its model, and then a view is loaded. However, I'm looking to also make this view accessible via an API. So, instead of the $data array being filled with information to populate into HTML, I would instead pass it to a different view which would output a JSON result. I imagine writing two different controllers would be a bad step to take - is there

Unable to load libraries when using CI 3 with HMVC

别来无恙 提交于 2019-12-06 03:35:44
I started a Modular project in CI2 (using HMVC). I am moving the project to CI 3. I am trying to autoload the session library using config/autoload .php $autoload['libraries'] = array('database','session'); I get this error: Fatal error: Call to undefined method MY_Loader::_ci_load_class() in /srv/www/htdocs/projects/application/third_party/MX/Loader.php on line 158 Even if a manually load the library within the controller using $this->load->library('session'), i get the same error. I am convinced this is an error caused by using HMVC. I have managed to make CI 3 modular but I am stuck with

Unable to send email using SMTP gmail config in codeigniter 3

别等时光非礼了梦想. 提交于 2019-12-05 15:58:58
Below are my code and I refer all examples in stack overflow and codeigniter user guide. still I unable to solve this public function send() { $config['protocol'] = 'smtp'; $config['smtp_crypto'] = 'ssl'; $config['smtp_host'] = 'smtp.gmail.com'; $config['smtp_port'] = '465'; $config['smtp_user'] = '**********@gmail.com'; $config['smtp_pass'] = '********'; $config['mailtype'] = 'html'; $config['charset'] = 'utf-8'; $config['newline'] = "\r\n"; $config['wordwrap'] = TRUE; $config['smtp_timeout'] = 30; $this->email->initialize($config); $this->email->from('uvizag@gmail.com', 'admin'); $this-

Codeigniter 3: How to use composer packages? (Twilio SDK)

末鹿安然 提交于 2019-12-04 16:52:29
What I did so far: I am pretty familiar with CI, but new to composer and the twilio SDK. Reading some tutorials and docs I managed to install composer and the twilio package. However the /vendor folder is parallel to my CI installation: /var/www/html/ - application - system - vendor I have therefore edited the config.php setting the path like this: $config['composer_autoload'] = '/var/www/html/vendor/autoload.php'; In my controller tried to use the SDK as documented in the Twilio SDK: <?php defined('BASEPATH') OR exit('No direct script access allowed'); class Test extends CI_Controller { use