Implementing a recursive menu system a'la Joomla in CodeIgniter

I have some sites powered by Joomla, but with my current assignment I wanted to try something new and created with CodeIgniter a really basic CMS (just to suit my client's needs). Everything works fine except menus - multilevel menus like in Joomla, Drupal etc. with items and subitems... My question is: do you know of any tutorials or texts abut implementing such a structure. I've tried the recursion thinggy with while getting children's IDs move downwards from the parent while searching for th

CodeIgniter email mail error

I'm getting this error with the mail() function in CodeIgniter: A PHP Error was encountered Severity: Warning Message: mail() [function.mail]: Bad parameters to mail() function, mail not sent. Filename: libraries/Email.php Line Number: 1519 Here is my mail script (part of my controller): $message = "...text..."; $this->load->library('email'); $this->email->from('oemsales@xxx.com', 'OEM Sales'); $this->email->to('xxxx@xxx.com'); $this->email->subject('Contact Page

Why is Authorize.net throwing an error when my relay response URL points to a CodeIgniter controller and not otherwise?

I'm not typically a web developer, but I'm a decent enough coder that I felt comfortable accepting a proposal from a friend to develop his brother's small business website. I'm nearly finished and I've been using CodeIgniter, which has been a huge help and was easy to jump into. They have a handful of products they'd like available for purchase via the site, their preference was Auth.net (which I have no previous experience with), and their host does not support SSL (nearlyfreespeech.net), so I

Codeigniter CI: Undefined Variable

I know similiar questions have been asked, but I've still been unable to resolve my issue. When my view loads, I get the error below, and I know there is a value in $id. Message: Undefined variable: id Filename: admin/upload_form.php Line Number: 17 Controller: public function getEventNameById( $id ) { $q = $this->event_model->getEventNameById( $id ); echo "Event Name: ".$q."</p>"; $data['id'] = $id; $this-&g

How do i redirect my all old url to new url Codeigniter

I want to redirect my all old url to new url. My few old URLs are domain.com/ domain.com/submit domain.com/get/soft-name domain.com/most-downloaded etc, etc, Now i want to redirect my all url to domain.com/en domain.com/en/submit domain.com/en/get/soft-name domain.com/en/most-downloaded I am using CodeIgniter. Please Suggest me some code for route.php thanks in advance

Codeigniter view all links after pagination

is it possible to add a view All results link after or before the << First 1 2 3 Last >> links of the pagination? I tried some thing like : // in controller (search) : if(uri_string()=='/search/results/all'){ $config['per_page'] = $config['total_rows']; }else{ $config['per_page'] = 10; } $page['pagination'] = $this->pagination->create_links(); // and in the view : echo $pagination .' '. '<a href="/search/results/all">View all resul

Codeigniter Where clause

Somehow its a bit difficult to for me to build a query like this: Give me all entries of navigation where linkname not null $query = $this->db->get_where('navigation',array('linkname'!==NULL)); Giving me Error Unknown column '0' in 'where clause' SELECT linkname, idnavigation FROM (navigation) WHERE 0 = 1 Any hints with this?

Single user system across multiple sites using Codeigniter and XenForo

I've got several sites that I'd basically like to have the same user system for. One of the sites runs XenForo, the others all run Codeigniter, or systems built on Codeigniter (e.g PyroCMS). I need to somehow be able to let a user login on any of the sites with the same username/password combination, in addition to be able to register. I know there are a number of ways of going about this, such as an OpenID server, however I'm not 100% sure which is best for my situation given that I'm usin

Google is indexing future dates on my codeigniter datepicker

If I do a google search for "harbour holidays 2 strand" then it returns my clients site www.padstow-self-catering.co.uk The problem is that google has decided to index and future date which can be seen from the datapicker on the right sidebar. Nearly all searches for specific holiday properties has this issue and the future date is different for each. I have no idea why this is happening?

Codeigniter How to use style sheet within a controller

I am having an application, in which I m showing some tabs through some xyz view. if anyone click on any of the tab it will call one of the function within a controller. This called controller function will then display some values based on the id passed through the tab. So I want to display those values through controller as well as to apply some style to generated output using some style.css file. Now my application is generating the output but I am unable to apply styles on it. Specially

Codeigniter redirect doesn't work

I’m building a jquery mobile version of my site using CodeIgniter. But I have a problem with the redirects. E.g : I am on the page « listComment »and I want to add a comment. When I add it, the function « AddComment » is launched and in this function I am redirected to « listComment ». But I don’t know why I am on the page : www.mysite.com/mycontroller/AddComment and not www.mysite.com/mycontroller/listComment. I can’t see my comment added and if I refresh I have a lot of error because I am not

How can I map a model to a specific controller in CodeIgniter-Simpletest unit test framework?

I am using codeigniter framework and I am using simpletest framework for unit testing my models. Each model have their own controller. Most of the url(s) that I use (for webservice response) for each model is mentioned in their own controller Constructor. When i run simpletest for each model, it takes all url from default controller which is set in routes.php. For example : Lets consider there are two controllers : controller1 & controller2 And there are two models : model1 & mode

Codeigniter Pagination- configuration(SQL statement)

I'm having a little problem on displaying the pagination. The pagination appears even there's only one query. I know that it is my sql statement on the $Pagesquery that is lacking. This is my controller //This will only display local packages public function displayLocalPackages($page=0,$offset=6,$search=''){ $search = $this->input->post('search'); $row = $this->m_tour->getAllLocalTours($offset,$page,$search); $data['usersTable'] = $row->r

Codeigniter Ion-auth: Switching from an admin to a user account

I'm very new to ion-auth so apologies in advance if this is a dumb question. I have a feature request from a user (an admin) where they would like to be able to switch into another user's account to see the app from their point of view. The use-case here is that the admin would find the user in question's account in our user admin page in the app, then click a button to effectively 'become' that user. Any ideas how this would be achieved? Many thanks Pete

Codeigniter Controller methods VS api methods

I have a controller to send send a message from my site: example.com/contact/send-message Ok here, but in my API I've created the same method: api.example.com/contact/send-message in the API should I keep the same method and just call the method inside the controller? When should I use controller methods or api methods?

Codeigniter: won't load controller page

I have a web page made with codeigniter, and everything works fine, but when I try to add another controller it gives me a:"404 Page Not Found" - "The page you requested was not found." Why? The controller i'm adding is the one from the tutorial (I'm practising): <?php class Blog extends CI_Controller { public function index() { echo 'Hello World!'; } } ?> I'm using Ubuntu, if it makes any difference.

Codeigniter uploading file issue, error not displaying

I am trying to restrict the file size when a user uploads. I have the following function: function do_upload() { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png|jpeg'; $config['max_size'] = '50'; //$config['max_width'] = '1024'; //$config['max_height'] = '768'; $this->load->library('upload', $config); $fullImagePath; if (isset($_FILES['userfile']) && !empty($_FILES['userfi

Codeigniter: Extend CI_Lang class when controller loaded to use &get_instance()

I want to extend my CI_Lang class to get language values from the database. So I created a copy of the CI_Lang file and rewrote the load and construct functions. private $CI; function __construct() { parent::__construct(); log_message('debug', "Language Class Initialized"); $this->CI = &get_instance(); } I enabled hooks in the config file and created a new hook: $hook['post_controller_constructor'] = array( 'class'

Codeigniter how do i get the current year and compare it with the file.text name

example: i have this file name change log 2013.txt but when its 2014, I want it to create new file name change log 2014.txt Anyone can help? this is my controller: <?php class changelog extends Controller { function changelog() { parent::Controller(); $this->load->helper('form'); } function index() { $this->change_log_add(); } function change_log_view() { $data['message'] = read_file('

Codeigniter Controller URI routing problems

I encounter problems when I call the method of a controller. By the way, this controller is routed. Routes $route['admin/company'] ='company'; Controller class Company extends CI_controller { public function __construct() { parent::__construct(); session_start(); /** Check if user is logged in */ if ($this->session->userdata('user') != "") { $this->load->model('my_model'); if ( $this->uri->segment(1) != "admi

Wrong time now (Codeigniter)

I have a problem in relation with the time now in Codeigniter. I'm using the timespan function in codeigniter. I have to get the current time and it returns a wrong current time now. My date in my pc(as of now) is 2013-07-04 3:21 PM but when I do this: $now = time(); $human = unix_to_human($now); echo $human; The output is 2013-07-05 12:20 AM. Why is that?

Codeigniter - two upload fields in one form

I'm trying to upload an image and an mp3 in Codeigniter, from a form with two file input fields. The image field is called userfile, the mp3 field is called trackfile. In my model I have this code (modified): $image_resource = $this->library_model->upload_image($_FILES); $data = array( 'name' => $this->input->post('name'), 'imageresource' => $image_resource ); $this->db->insert('table_name',$data);

Codeigniter Load Login site instead of the default controller site when no session is set

My default controller is home. When no session is set MY_Controller is in charge of loading login_view instead of home. Now, this works fine, it indeed does load the login_view when no session is set. But it loads it TOGETHER with home_view. In MY_Controller, when I set redirect(site_url('login')); instead of $this->load->view('login'); then nothing loads but a browser message: :( there is a redirection on this page MY_Controller: class My_Controller extends CI_Controller{ pu

CodeIgniter(2.1.4) Sessions is not working

I have a problem with CI sessions. I initialized my session library: $autoload[‘libraries’] = array(‘database’, ‘session’) (In config/autoload.php) This is my code: cycle $this->load->library(‘image_moo’); // Upload image and return unique name $data = array( ‘image’ => $image, ); $this->db->insert(‘category_images’, $data); if (!$this->session->userdata(‘uploadImages’)) { $this->session->set_userdata(‘uploadImages’, $this->db->insert_id());

Create Unique field in Codeigniter DBForge Migration

How can I make the financial_year field as unique using Codeigniter Dbforge migration? function up() { $this->dbforge->add_field(array( 'id' => array( 'type' => 'INT', 'constraint' => 11, 'unsigned' => TRUE, 'auto_increment' => TRUE ), 'financial_year' => array( 'type' => 'VARCHAR', 'constraint' => 20

Codeigniter CI_session and Error Number: 1054 (Unknown column ...)

I have got problem with ci_session. When I am creating query with Active Record and I use session, it throws me Error Number: 1054. It is caused by Session.php . I am using database session and when it executes sess_write(), then it throws error. Can I create new instance of $this->db ? Error is at line no. 289 in Session.php $this->CI->db->update($this->sess_table_name, array('last_activity' => $this->userdata['last_activity'], 'user_data' => $custom_userdata)); In th

Codeigniter Uploading video to Youtube to a master account

I need to have people sending videos directly to my customer's Youtube account. My customer doesn't want to have people login with their own Youtube account. This has to be transparent for people so they are not forced to have a Youtube account to send videos. I found several solutions like Youtube Direct lite or the Youtube Widget but this is not exactly what they need as it force them to log to their own account... Same with Youtube API and OAuth2... Is there any solution with the YouTube Dat

Codeigniter how to pass data from controller in multiple view

what i want is to pass data from controller in multiple view in codeigniter, for example function main(){ $data['test'] = 'test'; $json['json'] = $data $this->load->view('template/ajax', $json); } but i also want to load that data in $this->load->view('home', $json) aside from "template/ajax", i/ve tried this code but it did not work. function main(){ $data['test'] = 'test'; $data['otherview'] = $this->load->view('home', $data); $json['json'] = $data

Codeigniter email issue, I'm struggling to send email one after another

I am tring to send mails through codeigniter email class. Following is a method from my controller : $config['protocol'] = 'mail'; $config['mailtype'] = 'html'; $config['charset'] = 'iso-8859-1'; $config['wordwrap'] = TRUE; $this->email->initialize($config); $this->email->from('xxx@yyy.zzz'); for($i=0; $i< count($data); $i++) { $this->email->to($data[$i]['email']); $this->email->subject('Notification'); $this->email->message

Codeigniter Make Download URL inaccessible in address bar

I am creating an application where members as well non members can download books depending upon the category of book available for both users. I linked the books to BASE_URL/downloadPDF/11 for prompt download, passing the Id of the book, so that the file location is invisible to user. Now what I want is no one can get the book downloaded directly pasting the book url(BASE_URL/downloadPDF/11) in browser address bar. I tried making function private but It did not work for me.

Redirects with A3M for Codeigniter

I've been battling with redirects after users log in. The redirect is encoded into the URL. For example: http://demo.a3m.local:8090/account/sign_in/?continue=http%3A%2F%2Fdemo.a3m.local%3A8090%2Faccount%2Faccount_settings On this demo install it works perfectly. However on a development site it seems to double encode the url so it becomes: http://dev.mysite.local:8090/account/sign_in?continue=http%253A%252F%252Fdev.mysite.local%253A8090%252Faccount%252Faccount_profile Forward slash is enco

Codeigniter query builder to join 3 table

I need your help, i've table like this i want to view detail product when button view with id_product is clicked. This what i've done .. it seems i need single quote between id_product .. or is there a query builder from codeigniter to achieve this ?? function get_detail_product($id_product){ $query = "SELECT p.id_product, p.product_name, p.price, p.discount, c.category, b.brand_name, p.description, p.spesification, p.picture, p.begin_date, p.end_date, p.qty FROM tbl_

how to print_r a query in codeigniter? and where i mean controller or model

public function show_project() { $this->load->model('OPM_model/get_data'); $data['project_data'] = $this->get_data->get_all_projects(); foreach ($data['project_data'] as $p_id) { $user_id = $p_id->project_assigned_user_ids; $id = explode(",", $user_id); foreach ($id as $value) { $ide = $this->get_data->get_developer_name_by_id($value); echo '<pre>'; print_r($ide); } } // $ide= $th

Codeigniter Severity Notice: Undefined offset

With some changes I got the error, This work fine in raw php but in codeigniter I'm trying to get this result_array in a while(list), but I don't know what would be the alternative for fetch_row in codeigniter. Please help me to get this in a way at while (list($d, $sn, $s) = each($IDS-)) line. Model: public function raw_attendance_Data() { $this->db->select('attnDate, TraineeID, Status'); $this->db->from('tbl_attendance'); $this->db->order_by('Traine

Codeigniter Pagination on category home page

i have a blog where posts are shown in under different category id. In category home page i want to show 10 posts per page. But my pagination is not working. Can anybody help please? //////////Controller/////// public function categoryDetails($category_id) { $data = array(); $this->load->library('pagination'); $config['base_url'] = base_url() . 'Welcome/categoryDetails/'.$category_id; $data['total_rows'] = $this->WelcomeModel->select_number_of_published_blog_by

Codeigniter removing index.php in hmvc

i want to removing index.php in hmvc code igniter , when i type the url without index.php it's running well but when i process to other controller the url is automatically showing index.php after my codeigniter folder. example i type : localhost/ci_hmvc/user/login and the result when i process to other controller is : localhost/ci_hmvc/index.php/user/dashboard and my .htaccess <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILE

Codeigniter PHPMailer is sending with incorrect "date"

I have an issue with my code. All emails are sent with same date "31-mar-2017". here's the mail notification. Return-Path: <xxxxxx@gmail.com> Received: from ip-172-31-29-190 (ec2-xx-xxx-xx.xx.ap-south-1.compute.amazonaws.com. [xx-xxx-xx.xx]) by smtp.googlemail.com with ESMTPSA id a81sm7358557pfe.32.2017.11.02.08.27.05 for <xxxxxxxx@gmail.com> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Nov 2017 08:27:06 -0700 (PDT) Date

Codeigniter Email not send using Codelgniter

I want to send an email to the user who is verified by the Admin. When the admin clicks on verify button in DB the status of a user is changed and email sends to a user, status can change but the email not send. AdminController: if($this->AdminModel->updateUser($id , $status)){ $user_message = "hello"; $this->load->library('email'); $config['protocol'] = 'smtp'; $config['smtp_host'] = 'ssl://smtp.gmail.com'; $c

Codeigniter Error Trying to get property of non-object

I need to send SMS to all users that are not received one I have tried to use a session but the result is the same. When I print_r($uid), I have a value This is My Controller function bloc code public function sendemailsms() { $year = $this->db->get_where('settings', array('type' => 'running_year'))->row()->description; $attendance_report = $this->apply_model->getnosendattendanceemail();//get result //send sms to each one foreach($attendance_rep

Codeigniter random_bytes function is not working in CI 3, PHP 7.2

My Cpanel based server is running on PHP 7.2 using Codieigniter 3.x public function fxnname() { return random_bytes(SODIUM_CRYPTO_SECRETBOX_KEYBYTES); } When I run the code, I get the following error: Call to undefined function random_bytes() in my custom library code which is placed inside public_html/application/libraries/mycustomlibrary.php I tried to google and this function should have worked in PHP 7.2. Is there any library/helper which I am missing in autoload or something el

  1    2   3   4   5   6  ... 下一页 最后一页 共 39 页