Note the upgraded forum! If you are experiencing issues logging in, you may need to reset your password which should send an email. If the email doesn't arrive, be sure to check your spam folder just in case.

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 7:49AM
    The second parameter for parse_string should be an array of data to pass to the template string and not the boolean.
  • edited 7:49AM
    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 7:49AM
    $data = array('fullname' => $name, 'password' => $password); $str = $this->fuel->parser->parse_string('my_template', );
  • edited 7:49AM
    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.