• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
narrowed down error to call_hook('post_system')

#11
Dave, I was under the impression that

$route['default_controller'] = 'users/login';

meant the login() function in the users.pdf controller. Perhaps it should be sub_crud/Users/login but I thought the sub_crud was not needed. I am however using a subdirectory in the view but this is the way that codexworld designed it.

On another note, I am about to move my entire project over to run in vbox. I am hoping for a little more stability by doing this. It will take me quite a bunch of effort to make this move, so I am hoping that things will calm down a little after this and I can get back to debugging. Am I correct to think that going to vbox should reduce the uncertainty a little?
proof that an old dog can learn new tricks
Reply

#12
(11-20-2017, 11:21 PM)richb201 Wrote: Dave, I was under the impression that

$route['default_controller'] = 'users/login';

meant the login() function in the users.pdf controller. Perhaps it should be sub_crud/Users/login but I thought the sub_crud was not needed.

Yes, login function of the Users class (controller) which requires the file Users.php to be in the /applications/controllers/ directory.

(11-20-2017, 11:21 PM)richb201 Wrote: I am however using a subdirectory in the view but this is the way that codexworld designed it.
Putting a controllers and/or views in a subdirectories is not a big deal. However, I don't like putting controllers in subdirectories because of the strong tie between URLs and controllers. I prefer to keep URLs simple and I try to avoid using routes. In other words, I'd rather the URL be http://localhost/test_sessions than http://localhost/sub_crud/test_sessions.  Putting views in subdirectories doesn't affect the URL so that's not an issue for me.

Which codexworld tutorial are you using?

(11-20-2017, 11:21 PM)richb201 Wrote: On another note, I am about to move my entire project over to run in vbox. I am hoping for a little more stability by doing this. It will take me quite a bunch of effort to make this move, so I am hoping that things will calm down a little after this and I can get back to debugging. Am I correct to think that going to vbox should reduce the uncertainty a little?
For me the main advantage is being able to create a stack that closely, if not exactly, matches the eventual live host. Clients pay more quickly when what you provide works. It is a lot of effort to setup the first time (or two) but it is worth it to me. In my experience, VMs are less quirky and more stable than the WAMP or XAMPP type of stack. (Wow, look at all acronyms in one sentence. Sort feels like something a random buzz-word generator would produce.) It much easier to upgrade/downgrade versions of the web server, database and/or PHP in one of the Linux distributions in a VM as compared to the W/X-AMP stacks too.
Reply

#13
(11-20-2017, 09:51 AM)dave friend Wrote: I thought we had your session config figured out and working. If you're up for it, session config can be doubled check by using the controller and view shown below.

Once you have created the files point your browser to http://yoursite.dev/test_sessions and see if it works. as advertised in the comments in the controller file.

File: /application/controllers/Test_sessions.php
PHP Code:
<?php
/**
 * This class is useful for testing the configuration of the CodeIgniter "session" library.
 * It works only for CodeIgniter versions > 3.0.0
 * 
 * If "session" is properly configured then each click of the button will toggle the "status" of the user
 * as indicated by the text of the button. It changes from "Log In" to "Log Out" on each press.
 * No matter the "status", a reload of the page should not change the "status".
 * IOW, the button text won't change. 
 *
 * You should be able to browse away from this page and then back to it without the "status" changing.
 * 
 */
defined('BASEPATH') OR exit('No direct script access allowed');

class 
Test_sessions extends CI_Controller
{
    
/**
     * This constructor can be deleted if library 'session' AND helper 'form' are autoloaded.
     */
    
function __construct()
    {
        
parent::__construct();
        
$this->load->library('session');
        
$this->load->helper('form');
    }

    public function 
index()
    {
        
$this->load->view('test_sessions_view');
    }

    public function 
process_submit()
    {
        
//we literally check the button submit value to decide what to do
        
if ($this->input->post('submit') === "Log In")
        {
            
$_SESSION['status'] = "Log In";
        }
        else
        {
            
session_destroy();
        }
        
redirect('test_sessions''location');
    }


file: /application/views/test_sessions_view.php
PHP Code:
<!DOCTYPE html>
<
html>
 
   <head>
 
       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 
       <title>Session Testing</title       
    
</head>
 
   <body>
        <?
php
        
echo date("F j, Y, g:i:s a")."<br>"//so you can tell the page actually does refresh/reload
        
echo form_open('test_sessions/process_submit');
        
        
// button label depends on if 'status' is found in $_SESSION
        
$btn_text $this->session->status "Log Out" "Log In";
        echo 
form_submit('submit'$btn_text);
        echo 
form_close();
        
var_dump($this->session->userdata()); //Show all user data.
        
?>
    </body>
</html> 

I find this pair of files helpful because they focus on session class usage without much in the way of other logic to complicate the situation.

Dave, sorry I am so needy! I created both test_sessions.php (in controllers) and test_sessions_view.php (in views). I then try to start it with localhost/sub_crud/test_sessions.php and I get "object not found". Do I need to fool with the config.php?
proof that an old dog can learn new tricks
Reply

#14
If Test_sessions.php is in the controllers folder (and not a subfolder of controllers) then http://localhost/test_sessions (you don't need to add .php to the URL) should take you right there.

Note: The first letter of all controller file names MUST be uppercase i.e. Test_sessions.php

Looking at the URL you use it seems you could use a little adjustment to your XAMPP setup. You can make a change so that c:\xampp\htdocs\sub_crud\ is localhost - the you won't have to use http://localhost/sub_crud/some_controller
  1. Open for editing C:\xampp\apache\conf\httpd.conf.
  2. Find tag DocumentRoot "C:/xampp/htdocs"
  3. Edit tag to DocumentRoot "C:/xampp/htdocs/sub_crud"
  4. Now find tag < Directory > and change it to < Directory "C:/xampp/htdocs/sub_crud" >
You will want to make sure that $config['base_url'] is set correctly too.
I think the following should work after you adjust xampp

PHP Code:
$config['base_url'] = "http://localhost/"

Do all of the above then restart Apache (xampp).
Reply

#15
(12-01-2017, 05:08 PM)dave friend Wrote: If Test_sessions.php is in the controllers folder (and not a subfolder of controllers) then http://localhost/test_sessions (you don't need to add .php to the URL) should take you right there.

Note: The first letter of all controller file names MUST be uppercase i.e. Test_sessions.php

Looking at the URL you use it seems you could use a little adjustment to your XAMPP setup. You can make a change so that c:\xampp\htdocs\sub_crud\ is localhost - the you won't have to use http://localhost/sub_crud/some_controller
  1. Open for editing C:\xampp\apache\conf\httpd.conf.
  2. Find tag DocumentRoot "C:/xampp/htdocs"
  3. Edit tag to DocumentRoot "C:/xampp/htdocs/sub_crud"
  4. Now find tag < Directory > and change it to < Directory "C:/xampp/htdocs/sub_crud" >
You will want to make sure that $config['base_url'] is set correctly too.
I think the following should work after you adjust xampp

PHP Code:
$config['base_url'] = "http://localhost/"

Do all of the above then restart Apache (xampp).
I did all and then stopped apache and restarted. I type 

localhost/Test_sessions in the browser window and I get "Object Not Found". Any ideas?

I have found that when I type localhost\ in the browser, my Users.php now starts up. But how do I get to the Test_sessions.php?
proof that an old dog can learn new tricks
Reply

#16
If file naming conventions are correct and the path to Test_sessions.php is C:\xampp\htdocs\sub_crud\applications\controllers\Test_sessions.php and it doesn't work then a couple possible problems are:
  1. .htaccess is configured wrong. (Try http://localhost/index.php/Test_sessions and if that works .htaccess is to blame.)
  2. Some $route is interfering. (Comment out any custom routes to test.)
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.