Feature Requests item #526911, was opened at 2002-03-07 23:04
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=403614&aid=526911&group_id=31885
Category: None
Group: Next Release (example)
>Status: Closed
Priority: 5
Submitted By: Carlos Sanchez (txarly)
>Assigned to: Richard Archer (richardarcher)
Summary: template.inc Hack: Send output to FILES
Initial Comment:
Hi to all!
I've been working in a project in which I needed to
send HTML emails. I love the PHPLib's template Class,
but It didn't have any method to output the whole
bunch of HTML to a file instead to the browser. I
needed this because the HTML of the email was dynamic,
you know: It needed brackets in it. {user_name}, etc.
I generated an HTMl file, and then attached to the
email using a fantastic class that I found out there.
I've added a new method, called p_file(), that is
quite similar to p(), but instead of printing all the
output of the page, it stores the whole bunch in a
file.
So... here is it:
/***********************************************/
/* public: p(string $varname)
* varname: name of variable to print.
*/
function p($varname) {
print $this->finish($this->get_var($varname));
}
/**********************************************/
/* public: p_file(string $varname, string $path,
string $file_name)
* varname: name of variable to print.
* Txarly :) Hack!! Print the complete output to a
file!!
*/
function p_file($varname , $path , $file_name) {
// Open the file
$fp = fopen ($path.$file_name, "w+");
// Send the output
fwrite($fp,$this->finish($this->get_var($varname)));
fclose($fp);
}
Pretty simple, isn't it??
Hope this'd help. Maybe it could be added in the next
release!!
Thankx for a great library.
Txarly :)
----------------------------------------------------------------------
>Comment By: Richard Archer (richardarcher)
Date: 2002-04-25 18:57
Message:
Logged In: YES
user_id=279311
Closing this because the feature should be part of the
application logic, not the template engine.
----------------------------------------------------------------------
Comment By: Richard Archer (richardarcher)
Date: 2002-03-08 07:35
Message:
Logged In: YES
user_id=279311
I suggest using the already-present t->get() function?
Get the finished template output and write it to a file in
your code. Or inject it straight into your mail queue.
...R.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=403614&aid=526911&group_id=31885
|