[done] Loades view as data and a wrong output - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: Model-View-Controller (https://forum.codeigniter.com/forumdisplay.php?fid=10) +--- Thread: [done] Loades view as data and a wrong output (/showthread.php?tid=1204) |
[done] Loades view as data and a wrong output - superheld - 02-18-2015 Hi! Okay, i try to explain what i mean with this topic :) I have expand the view with some additional features to build a small templating-system. Here is the code. It's a little bit messe becouse of a rewriting an older idea. PHP Code: class PAGES_Loader extends CI_Loader Now i use my methods to add data to my template in my controller PHP Code: public function erstellen ($box_id) First, the page.php will be loaded. It only contains two variables for header and body. PHP Code: <!DOCTYPE html> Header and Body are part of my "template-engine". Header is is only html-code (as you can find in the next code-block) and body loads the elements. Code: <body id="page-top" class="index"> template only shows what elements are available. Its the file members.php which is loaded as last view in my first listing. PHP Code: <?php echo $navigator; ?> But if i open my html-source in my browser, i found this: Code: [... MY ELEMENTS FROM THE LAST LISTING (members.php)...] My problem is, that my elements not in the body-file. It loads all an the right place (header and body in page.php, and also the members.php is loaded, but not in body. Why this? I can't understand at the moment... If you have a hint for me ... thanks a lot :)[/php] RE: Loades view as data and a wrong output - mwhitney - 02-19-2015 More than likely it's this line in PAGES_Loader->create_view(): $this->page['body']['template'] = $this->view($data['template'], $this->page['body']['elements'], '', TRUE); You have too many arguments for $this->view(), so it's probably starting the output before you get down to $this->view('page', $this->temp); RE: Loades view as data and a wrong output - superheld - 02-21-2015 You are so right I didn't saw it, just check the "TRUE" option... Thank you |