• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pass a variable with html content into parser

#1
[eluser]Sara rad[/eluser]
Hi everyone

i have a variable with html content like it :

Code:
$data['usrename'] = 'sara';
$tpl = '<p style="color:red">{username}</p>';

how can i use this in parser library instead of a template file ?

#2
[eluser]Sara rad[/eluser]
this way workd but im looking for better way :


Code:
$data['content'] = '<p style="color:red;">Hi {username} , welcome to our site</p>';

$fh = fopen('application/views/file.tpl', 'w') or die("can't open file");    
fwrite($fh, $data['content']);
fclose($fh);

$data['username'] = 'sara';

$this->parser->parse('file.tpl',$data);

#3
[eluser]Sara rad[/eluser]
Any idea ?


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.