Welcome Guest, Not a member yet? Register   Sign In
New to CI. Getting very strange results...
#1

[eluser]cwoolley[/eluser]
Thanks in advance for any help!

I have a site hosted at Ipower.com. CI seems to work with the host. I have contacted the tech support, but they haven't been helpful at all.

I have been following tutorials on various websites and until now all the simple things have made sense and worked well.

However, I have run into a very annoying problem which I have not been able to find a solution to. I've narrowed my problem down to the following:

The CI framework 'craps out' when I try to access certain functions. The one I'm certain about is "base_url()". When I call it, the server just seems to do nothing. My browser source is completely blank afterwards.

----------------------My Controller Code------------------------
<?php
class Mycal extends Controller {

function display1() {

$this->load->library('calendar');

echo $this->calendar->generate();

}

function display2() {

$conf = array(
'start_day' => 'monday',
'show_next_prev' => true
);

$this->load->library('calendar', $conf);

echo $this->calendar->generate();

}

function display3() {

$conf = array(
'start_day' => 'monday',
'show_next_prev' => true,
'next_prev_url' => base_url() . 'mycal/display3'
);

$this->load->library('calendar', $conf);

echo $this->calendar->generate();

}

function display4() {

echo base_url();

}

}
---------------------------End Controller Code---------------------------------

I know I'm supposed to display things in views, but I've tried to isolate the issue by cutting out everything. Normally, I wouldn't be echoing anything in my controller.

display1 and display2 both work correctly as advertised.

display3 and display4 show absolutely nothing in the browser.

After accessing each of the functions in order (ie. display1, 2, 3 & 4), my error log shows the following:

DEBUG - 2010-05-31 04:34:01 --> Config Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Hooks Class Initialized
DEBUG - 2010-05-31 04:34:01 --> URI Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Router Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Output Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Input Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Global POST and COOKIE data sanitized
DEBUG - 2010-05-31 04:34:01 --> Language Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Loader Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Database Driver Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Controller Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Language file loaded: language/english/calendar_lang.php
DEBUG - 2010-05-31 04:34:01 --> Calendar Class Initialized
DEBUG - 2010-05-31 04:34:01 --> Final output sent to browser
DEBUG - 2010-05-31 04:34:01 --> Total execution time: 0.5381
DEBUG - 2010-05-31 04:34:05 --> Config Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Hooks Class Initialized
DEBUG - 2010-05-31 04:34:05 --> URI Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Router Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Output Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Input Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Global POST and COOKIE data sanitized
DEBUG - 2010-05-31 04:34:05 --> Language Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Loader Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Database Driver Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Controller Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Language file loaded: language/english/calendar_lang.php
DEBUG - 2010-05-31 04:34:05 --> Calendar Class Initialized
DEBUG - 2010-05-31 04:34:05 --> Final output sent to browser
DEBUG - 2010-05-31 04:34:05 --> Total execution time: 0.6638
DEBUG - 2010-05-31 04:34:16 --> Config Class Initialized
DEBUG - 2010-05-31 04:34:16 --> Hooks Class Initialized
DEBUG - 2010-05-31 04:34:16 --> URI Class Initialized
DEBUG - 2010-05-31 04:34:17 --> Router Class Initialized
DEBUG - 2010-05-31 04:34:17 --> Output Class Initialized
DEBUG - 2010-05-31 04:34:17 --> Input Class Initialized
DEBUG - 2010-05-31 04:34:17 --> Global POST and COOKIE data sanitized
DEBUG - 2010-05-31 04:34:17 --> Language Class Initialized
DEBUG - 2010-05-31 04:34:17 --> Loader Class Initialized
DEBUG - 2010-05-31 04:34:17 --> Database Driver Class Initialized
DEBUG - 2010-05-31 04:34:17 --> Controller Class Initialized
DEBUG - 2010-05-31 04:34:23 --> Config Class Initialized
DEBUG - 2010-05-31 04:34:24 --> Hooks Class Initialized
DEBUG - 2010-05-31 04:34:24 --> URI Class Initialized
DEBUG - 2010-05-31 04:34:24 --> Router Class Initialized
DEBUG - 2010-05-31 04:34:24 --> Output Class Initialized
DEBUG - 2010-05-31 04:34:24 --> Input Class Initialized
DEBUG - 2010-05-31 04:34:24 --> Global POST and COOKIE data sanitized
DEBUG - 2010-05-31 04:34:24 --> Language Class Initialized
DEBUG - 2010-05-31 04:34:24 --> Loader Class Initialized
DEBUG - 2010-05-31 04:34:24 --> Database Driver Class Initialized
DEBUG - 2010-05-31 04:34:24 --> Controller Class Initialized

It appears to me that once the base_url() function is called, the server just quits.

Am I to assume that Ipower & CI are just not compatible? or is there something simple that I'm missing?

Thanks again for any help!
#2

[eluser]Clooner[/eluser]
I believe the function is base_url() and not baseurl(). Also try to enable error displaying. By putting the following in the index.php to see the php error
Code:
error_reporting(E_ALL);
ini_set('display_errors', 1);
#3

[eluser]cwoolley[/eluser]
Sorry, you are correct. It is base_url(). It is written correctly in display3, but I didn't type it correctly in display4.

error_reporting(E_ALL); is currently set. But I will set the other and see what comes back.

Thanks!
#4

[eluser]cwoolley[/eluser]
[quote author="clooner" date="1275314054"]I believe the function is base_url() and not baseurl(). Also try to enable error displaying. By putting the following in the index.php to see the php error
Code:
error_reporting(E_ALL);
ini_set('display_errors', 1);
[/quote]

clooner: I set the ini_set code and now I get the following error in both display3 and display4 functions:
Fatal error: Call to undefined function: base_url() in .../CI/application/controllers/mycal.php on line 30

Is there some setting I've missed to define the library(s) where these functions reside?
#5

[eluser]php dude[/eluser]
you can use error_reporting(-1); which will display any errors that may occur
#6

[eluser]Clooner[/eluser]
You didn't load the url helper.

Code:
$this->load->helper('url');

or put it in the autoload
#7

[eluser]cwoolley[/eluser]
clooner: you are my new best friend. Thank you. I've been working on this for hours. Maybe it is too late for me to be up trying to learn. I am old, after all ;-)

That was the problem.

Thank you very much for your help and expertise.




Theme © iAndrew 2016 - Forum software by © MyBB