How can I want pass a string with the view content instead of a file name when loading a view? |
[eluser]frankabel[/eluser]
Hi all, I just want make something like: Code: $this->load->view($str_with_view_content, $data, TRUE); instead of: Code: $this->load->view('path_of_view_content', $data, TRUE); What options I have to archieve this? Thanks in advanced. Frank
[eluser]TWP Marketing[/eluser]
[quote author="frankabel" date="1348533897"]Hi all, I just want make something like: Code: $this->load->view($str_with_view_content, $data, TRUE); instead of: Code: $this->load->view('path_of_view_content', $data, TRUE); What options I have to archieve this? Thanks in advanced. Frank[/quote] Place the variable: $str_with_view_content, inside your data array: Code: ...
[eluser]frankabel[/eluser]
With "str_with_view_content" I mean a string that have the html with PHP tags inside. So, what I want is avoid load the content from a file, and load it from a string var.
[eluser]CroNiX[/eluser]
http://ellislab.com/codeigniter/user-gui...utput.html
[eluser]frankabel[/eluser]
Thanks all for the replies, but seem to me that I don't explain myselft well and replies are not related to my questions. So, lets put this question in verbose mode ![]() view/viewfile.php: Code: <html> controller/controllerfile.php Code: class Controllerfile extends CI_Controller { That is the normal CI workflow but what I want is something like: controller/controllerfile.php Code: class Controllerfile extends CI_Controller { so, what I need is pass the view content to the "load->view" function as a var instead of a file name, my goal is kind of allow users define view content and store into the database, not in the file system. Thanks for your patience. Frank
[eluser]CroNiX[/eluser]
Read the link in my post. It tells how to do exactly what you are asking....set a string as the output. You don't use "load" for this... load loads files.
[eluser]frankabel[/eluser]
Thanks again. I read the link first time you sent it but I don't get it ![]() If you are refering to: Code: $this->output->set_output($data); well, I really don't know what Code: $data Code: $data Code: '<html><body><h1> My name is:<?php echo $name?></h1></body></html>' Code: echo $name |
Welcome Guest, Not a member yet? Register Sign In |