Welcome Guest, Not a member yet? Register   Sign In
Reverse Parsing (CI parser template) ??
#1

[eluser]rpe[/eluser]
Usually if we want to parse a variable, we need to define it first. Can we do the opposite way? Parsing first and define the variable later??

Example :
1.>This is what I usually do, I define the variable first, I put it in var.php.
Code:
class Example extends Controller{
function index(){
data['variable']=$this->load->view('variable','',TRUE);
$this->load->view('display');
}
}

then I use the variable in display.php
Code:
<html>
<head></head>
<body>
{variable}
</body>
</html>

2.>But, what I want is this, I use the variable first (in display.php)
Code:
<html>
<head></head>
<body>
{variable}
</body>
</html>

then I parse using this (var.php)
Code:
data[$var]=$this->load->view($var);

Thanks before.
#2

[eluser]Phil Sturgeon[/eluser]
wtf?
#3

[eluser]luke holder[/eluser]
[quote author="Phil Sturgeon" date="1250274509"]wtf?[/quote]

HAHAHAHAHAHA
#4

[eluser]wabu[/eluser]
If I understand your post correctly, and that's really what you need to do, then you could just duplicate your first example with your "display" view, returning the output into a local variable for string substitution.

Then you can render your doubly-parsed template. Wink




Theme © iAndrew 2016 - Forum software by © MyBB