problem rendering templates

edited January 2016 in Bug Reports
I created a module that stores templates until it is later used by the code to send email to user, using the templating engine, I passed a variable from the textarea to the database e.g {$fullname}.

The problem here is when i wanna use up the template in my code, i get undefined variable error. this is what am using $CI->parser->parse_string($template, TRUE);. the $template is a raw html containing the templating tage loaded from the database.

What am I missing here, Your help will be much appreciated.

Thanks in anticipation

Comments

  • edited 12:31PM
    The second parameter for parse_string should be an array of data to pass to the template string and not the boolean.
  • edited 12:31PM
    its ok thanks for your response but considering what am parsing




    Dear, {$fullname}




    Your new password is: {$password}

    You can change your password at any time by logging into your account.




    How do i go about it.
  • edited 12:31PM
    $data = array('fullname' => $name, 'password' => $password); $str = $this->fuel->parser->parse_string('my_template', );
  • edited 12:31PM
    Thanks so much, it worked. Now i understand the parser class, I have to put the variable from the templating engine in an array.
Sign In or Register to comment.