Welcome Guest, Not a member yet? Register   Sign In
How can I want pass a string with the view content instead of a file name when loading a view?
#5

[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 Wink

view/viewfile.php:
Code:
<html>
    <body>
      <h1> My name is:&lt;?php echo $name?&gt;</h1>
    &lt;/body&gt;
&lt;/html&gt;


controller/controllerfile.php
Code:
class Controllerfile extends CI_Controller {

    public function index()
    {
        $data = array ('name' => 'Frank');
        $this->load->view('viewfile', $data);
    }
}

That is the normal CI workflow but what I want is something like:

controller/controllerfile.php
Code:
class Controllerfile extends CI_Controller {

    public function index()
    {
        $data = array ('name' => 'Frank');
        $viewContent = '&lt;html&gt;&lt;body><h1> My name is:&lt;?php echo $name?&gt;</h1>&lt;/body&gt;&lt;/html>';
        $this->load->SOME_FUNCTION_OR_WHATEVER($viewContent, $data);
    }
}

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


Messages In This Thread
How can I want pass a string with the view content instead of a file name when loading a view? - by El Forum - 09-26-2012, 03:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB