|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
pyromanci Smarty n00b
Joined: 16 Mar 2017 Posts: 2
|
Posted: Thu Mar 16, 2017 3:11 pm Post subject: Odd Unknown Tag problem |
|
|
I seem to be having a very odd unknown tag problem.
I have this template. That I went through and replaced all teh static text with Template variables (the CSS does have a {literal} around it).
https://htmlpdfapi.com/uploads/attachments/56603852726169116d960100/invoice_1.html?1449146449
I then used this code to generate and parse the output.
Code: | $invoiceSmarty = new SmartyBC();
$invoiceSmarty->muteExpectedErrors();
$invoiceSmarty->disableSecurity();
$invoiceSmarty->assign("company_name", $this->config->item('app.company.name'));
$invoiceSmarty->assign("company_address", $this->config->item('app.company.address'));
$invoiceSmarty->assign("company_address2", $this->config->item('app.company.address2'));
$invoiceSmarty->assign("company_city", $this->config->item('app.company.city'));
$invoiceSmarty->assign("company_state", $this->config->item('app.company.state'));
$invoiceSmarty->assign("company_zip", $this->config->item('app.company.zip'));
$invoiceSmarty->assign("company_phone", $this->config->item('app.company.phone'));
$invoiceSmarty->assign("company_email", $this->config->item('app.company.email'));
$invoiceSmarty->assign("client_company", $this->input->post('company_name'));
$invoiceSmarty->assign("client_contact", $this->input->post('contact_first_name'). ' ' .$this->input->post('contact_last_name'));
$invoiceSmarty->assign("client_address", $this->input->post('address1'));
$invoiceSmarty->assign("client_address2", $this->input->post('address2'));
$invoiceSmarty->assign("client_city", $this->input->post('city'));
$invoiceSmarty->assign("client_state", $this->input->post('state'));
$invoiceSmarty->assign("client_zip", $this->input->post('zip'));
$invoiceSmarty->assign("client_email", $this->input->post('email'));
$invoiceSmarty->assign("client_phone", $this->input->post('phone'));
$invoiceSmarty->assign("invoice_number", str_pad($invoice_id, 7, "0", STR_PAD_LEFT));
$invoiceSmarty->assign("invoice_date", date('m/d/Y'));
$invoiceSmarty->assign("invoice_duedate", $this->input->post('duedate'));
$template = 'string:'.$this->config->item('app.invoice.template');
$out = $invoiceSmarty->fetch($template); |
However what i get is the following error:
Code: | Type: SmartyCompilerException
Message: Syntax error in template "string:<!DOCTYPE html> <html> <head> <title>In..." on line 290 "<h2 class="title">{company_name}</h2>" unknown tag "company_name"
Filename: Smarty\sysplugins\smarty_internal_templatecompilerbase.php
Line Number: 290
|
I've gone in and filled the values in statically. I've renamed the template variables. I just keep seeming to get this error.
The version of Smarty I'm using is 3.1.30 on PHP 7. Any one have any suggestions or ideas? |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Mar 16, 2017 5:13 pm Post subject: |
|
|
{$company_name} |
|
Back to top |
|
pyromanci Smarty n00b
Joined: 16 Mar 2017 Posts: 2
|
Posted: Thu Mar 16, 2017 5:16 pm Post subject: |
|
|
OMG. I think I've been staring at this code for far to long not to notice i forgot the $. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Thu Mar 16, 2017 6:30 pm Post subject: |
|
|
It's a matter of reading the error message correctly. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|