Re: Put in file

From: Date: Fri, 09 Jul 2004 13:50:26 +0000
Subject: Re: Put in file
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-11555@lists.php.net to get a copy of this message
Juan Pablo Herrera wrote:
Hi! I need put the content of $smarty->display(template.tpl), in a file .txt. The function that using in php is fwrite. Can I using this function? Thank You. Juan <?php
$filename = 'test.txt'; $content = $smarty->fetch('template.tpl'); if (is_writable($filename)) { if (!$handle = fopen($filename, 'a')) {
        print "Cannot open file ($filename)";
        exit;
} if (!fwrite($handle, $content)) {
       print "Cannot write to file ($filename)";
       exit;
}
    fclose($handle);
} ?> I also use the $smarty-.fetch('email.txt') to send emails. Works a treat !! Pete

« previous php.smarty.general (#11555) next »