hello I am adding a "send invoice inline" option and was wondering how to call a smarty template. In addition to that I am also adding a check box to say yes or no to the PDF attachment, so you will be able to be able to send it inline as a pdf attachment or both. In this process I am looking to create an code over ride system so that people can customize code w/o fear of having upgrades over write their changes.
basically you create all the php code in say ./modules/invoices/email.php and create the view/smarty stuff in ./templates/default/invoices/email.tpl
and index.php 'joins' them together
note: only variables youve defined in the .php using $smarty->assign ie. $smarty -> assign('pageActive', $pageActive); are availble for display in the .tpl file
re code override system - awesoem - i've anted to do such a thing for ages but never got around to doing ti
let us know how you go - can't wait to see your code
All the over ride system will take is replacing the include and include_once type files and replace then w/ an over ride system. I created an an a custom operations function that will allow people to add snippets to a file via class and file name already. I have worked heaps w/ the program Zen Cart that has an awesome over rides system and will be basing my work on that code. for the Invoices bit I am going to try and used the custom templates used for the pdf files. so if you could help me fill in the blanks below,I will finish and take it form there. if ($_POST['formatInline'] == 1) { $inline_body_html = "calling the template"; }
PS I really dis like smarty and will as I get more involved in this project become a nag about my dis like of it. It seems like doing work twice
A developers note, In the using of the same template files for both the PDF and the inline email release of the invoice we will need to have the CSS running in line.
Also I am stuck on the smarty issue. w/ real PHP to make a file a var I would just read the file and assign it as a var and then do what i needed to. it seems here that I have to call the template as a URL string and some how it sets all the info in to the right place. that is all good and happy when i am just having a PDF created and then attaching it when i send the email that is fine. but when i want to call that info as variable that is totally different, as far as i can tell. Stuck here,
email me your gmail account name and i'll add you to our svn
that way you can check in your code and i can have a look to see if i can help with what your stuck on
re smarty - takes a while to get used to - but separating the php code from the presentation code has helped us alot - as before my code was all over the place :)