CodeIgniter Forums
Application layout - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Application layout (/thread-1829.html)



Application layout - El Forum - 06-29-2007

[eluser]emperius[/eluser]
I just read the wiki article http://codeigniter.com/wiki/layout_library/

and tried to do this at my application but I get a error
Fatal error: Call to a member function on a non-object in /home/worldofm/public_html/apartments/system/application/controllers/chisinau.php on line 12

When I tried to find out what's the problem I saw that load object doesn't exist in the controller

chisinau Object
(
[_ci_ob_level] =>
[_ci_view_path] =>
[_ci_is_php5] =>
[_ci_is_instance] =>
[_ci_cached_vars] => Array
(
)

[_ci_classes] => Array
(
)

[_ci_models] => Array
(
)

[_ci_helpers] => Array
(
)

[_ci_plugins] => Array
(
)

[_ci_scripts] => Array
(
)

[_ci_varmap] => Array
(
[unit_test] => unit
[user_agent] => agent
)

[_ci_scaffolding] =>
[_ci_scaff_table] =>
)

What is the problem?


Application layout - El Forum - 06-29-2007

[eluser]ztinger[/eluser]
can you post the code in your controller chisinau.php ?


Application layout - El Forum - 06-29-2007

[eluser]emperius[/eluser]
[quote author="ztinger" date="1183151722"]can you post the code in your controller chisinau.php ?[/quote]
here it is

<?php
class Chisinau extends Controller {
function Chisinau()
{
$this->load->library('layout', 'layout_main');
}

function index()
{
$this->layout->view('/chisinau/index', $data);
test();
}
}
?>


Application layout - El Forum - 06-29-2007

[eluser]axle_foley00[/eluser]
What is the function test() doing in your index() method? You are calling a function that doesn't exist. You also have the variable $data being passed to $this->layout->view('/chisinau/index', $data); when you haven't assigned anything to that variable.


Application layout - El Forum - 06-29-2007

[eluser]emperius[/eluser]
function test is in the helper which loads automaticaly...

I think data variable desn't have anything common with this error

The problem is that I can't load libraries


Application layout - El Forum - 06-29-2007

[eluser]axle_foley00[/eluser]
and as the instructions say on the Wiki you have the Layout.php file located in your "/application/libraries/" folder?


Application layout - El Forum - 06-29-2007

[eluser]emperius[/eluser]
of course

I also tried to use uri class and get the same error
$product_id = $this->uri->segment(1);


Fatal error: Call to a member function on a non-object in /home/worldofm/public_html/apartments/system/application/controllers/chisinau.php on line 18


Application layout - El Forum - 06-29-2007

[eluser]axle_foley00[/eluser]
[quote author="emperius" date="1183197522"]I think data variable desn't have anything common with this error
[/quote]

That's true, but it will cause an error once you get the other one fixed and it remains unassigned. Just pointing that out since I noticed it while looking through your controller code. Smile


Application layout - El Forum - 06-29-2007

[eluser]emperius[/eluser]
[quote author="axle_foley00" date="1183199682"][quote author="emperius" date="1183197522"]I think data variable desn't have anything common with this error
[/quote]

That's true, but it will cause an error once you get the other one fixed and it remains unassigned. Just pointing that out since I noticed it while looking through your controller code. Smile[/quote]

thank you Wink


Application layout - El Forum - 06-29-2007

[eluser]axle_foley00[/eluser]
Hmm...this is very strange. I'm currently using the exact same library on a project and it's working perfectly. Your code looks fine to me also. (scratches head)