![]() |
problem with my template - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: problem with my template (/showthread.php?tid=59574) |
problem with my template - El Forum - 10-22-2013 [eluser]raffie77[/eluser] Hi people, i'm a newbe here :-) I have created a template. this is my conroler: Code: <?php if (!defined('BASEPATH')) exit('No direct script access allowed'); this is my model: Code: <?php under views I have this header: Code: <!DOCTYPE html> and I have a footer with som basic stuff. oh yes and my template file under views: Code: <?php well the problem is this: when I open index, welcome, and image, all goes well but when I open overview, I get an error: Quote:A PHP Error was encountered btw C:\xampp\htdocs\test\application\models\get_DB.php:16 = Code: echo $this->table->generate($query); anny idea what goes wrong? Ralph problem with my template - El Forum - 10-22-2013 [eluser]CroNiX[/eluser] Because you are echoing straight from a controller or model instead of using the output class or view, so that gets output immediately followed by the headers and CI's output, which causes the error because you output something before headers were sent, and then you sent more headers. problem with my template - El Forum - 10-22-2013 [eluser]raffie77[/eluser] [quote author="CroNiX" date="1382468142"]Because you are echoing straight from a controller or model instead of using the output class or view, so that gets output immediately followed by the headers and CI's output, which causes the error because you output something before headers were sent, and then you sent more headers.[/quote] Ok so do I understand it correctly dat you don't use echo or print(f) in a contorler or model? instead of that I use return, all the echo's are placed in the view? problem with my template - El Forum - 10-23-2013 [eluser]Otemu[/eluser] Hi, No you shouldn't be echoing/print anything in model/controllers. The only time I might echo/print/dump something in the controller/model is when am testing something and want to see what is returned. The view is the presentation layer, so anything you need to echo out should be in that view. |