Parse template/data - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Parse template/data (/showthread.php?tid=20674) |
Parse template/data - El Forum - 07-17-2009 [eluser]stuffradio[/eluser] I want to know how to parse a template with the native template parser as well as add the normal Model data to the view. Example: Code: $data['something'] = $this->model->function(); So I want to do the same thing as Code: $this->load->view('viewfile', $data); Parse template/data - El Forum - 07-17-2009 [eluser]Jondolar[/eluser] Merge your original $data array with your second array instead of reassigning a new array to $data. use the array_merge() function. Parse template/data - El Forum - 07-18-2009 [eluser]stuffradio[/eluser] Using my own parser library Code: <?php Parse template/data - El Forum - 07-18-2009 [eluser]Jondolar[/eluser] Stuffradio, I don't think that was his problem. He has two arrays with find/replace pairs, not one array with find pattern and another array with replace pattern. He needs to either merge his arrays or he needs move the $data['something'] assignment below the line that creates the $data array in the first place. Parse template/data - El Forum - 07-18-2009 [eluser]stuffradio[/eluser] Jondolar you just replied to my post as if I wasn't the OP. I can't use the template parser the way I want to, I already know about the array merging issue but that wasn't going to solve it anyways. Parse template/data - El Forum - 07-18-2009 [eluser]Jondolar[/eluser] LOL, sorry, I'm not on drugs, really. Parse template/data - El Forum - 07-18-2009 [eluser]stuffradio[/eluser] [quote author="Jondolar" date="1247962319"]LOL, sorry, I'm not on drugs, really.[/quote] That's what they all say |