hi all. I have an html file that I need php to read and send as an html
e-mail. The file contains standard html and also some variable names
that I want php to interpolate:
<html>
Hi there. my name is $name
</html>
I'm reading the file like so:
$fh=fopen('./emails/confirmation/index.html', 'r') or die
($php_errormsg) ;
while (! feof($fh)){
$body.=fread($f h,filesize('./emails/confirmation/index.html'));
}
PHP is not interpolating the variable names in the email. Solutions?
-Magic 5 1300
magic_hat60622 wrote:
hi all. I have an html file that I need php to read and send as an html
e-mail. The file contains standard html and also some variable names
that I want php to interpolate:
<html>
Hi there. my name is $name
</html>
I'm reading the file like so:
$fh=fopen('./emails/confirmation/index.html', 'r') or die
($php_errormsg) ;
while (! feof($fh)){
$body.=fread($f h,filesize('./emails/confirmation/index.html'));
}
PHP is not interpolating the variable names in the email. Solutions?
-Magic
Why not just put the html of the message you want to send into a
variable in that script??
Are there reason why your reading a file for such a small amout of
text/html??
Just seems to be more work then needed unless you have users making
these files and want them to be in a static place for your script to
read from.
*** magic_hat60622 escribió/wrote (4 Aug 2006 09:31:59 -0700):
$fh=fopen('./emails/confirmation/index.html', 'r') or die
($php_errormsg) ;
while (! feof($fh)){
$body.=fread($f h,filesize('./emails/confirmation/index.html'));
}
PHP is not interpolating the variable names in the email. Solutions?
Thanks God, PHP does not treat all files it reads as PHP code! Just use
str_replace() on $body to replace the values you want. I suggest, though,
that you chose another markup that's not so prone to undesired
replacements. Some ideas:
{$foo}
%FOO%
[%foo%]
....
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Alvaro G. Vicario wrote:
*** magic_hat60622 escribió/wrote (4 Aug 2006 09:31:59 -0700):
$fh=fopen('./emails/confirmation/index.html', 'r') or die
($php_errormsg) ;
while (! feof($fh)){
$body.=fread($f h,filesize('./emails/confirmation/index.html'));
}
PHP is not interpolating the variable names in the email. Solutions?
Thanks God, PHP does not treat all files it reads as PHP code! Just use
str_replace() on $body to replace the values you want. I suggest, though,
that you chose another markup that's not so prone to undesired
replacements. Some ideas:
{$foo}
%FOO%
[%foo%]
...
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Why not just use .php instead of .html?
dawnerd wrote:
Alvaro G. Vicario wrote:
>>*** magic_hat60622 escribió/wrote (4 Aug 2006 09:31:59 -0700):
>>>$fh=fopen( './emails/confirmation/index.html', 'r') or die ($php_errorm sg) ; while (! feof($fh)){ $body.=fread ($fh,filesize(' ./emails/confirmation/index.html')); }
PHP is not interpolating the variable names in the email. Solutions?
Thanks God, PHP does not treat all files it reads as PHP code! Just use str_replace () on $body to replace the values you want. I suggest, though, that you chose another markup that's not so prone to undesired replacement s. Some ideas:
{$foo} %FOO% [%foo%]
...
-- -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain ++ Mi sitio sobre programación web: http://bits.demogracia.com +- Mi web de humor con rayos UVA: http://www.demogracia.com --
Why not just use .php instead of .html?
Because PHP will still not parse a file read with fread(), no matter
what the extension.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
Jerry Stuckle wrote:
dawnerd wrote:
Alvaro G. Vicario wrote:
>*** magic_hat60622 escribió/wrote (4 Aug 2006 09:31:59 -0700):
$fh=fopen(' ./emails/confirmation/index.html', 'r') or die ($php_errorms g) ; while (! feof($fh)){ $body.=fread( $fh,filesize('./emails/confirmation/index.html')); }
PHP is not interpolating the variable names in the email. Solutions?
Thanks God, PHP does not treat all files it reads as PHP code! Just use str_replace( ) on $body to replace the values you want. I suggest, though, that you chose another markup that's not so prone to undesired replacements . Some ideas:
{$foo} %FOO% [%foo%]
...
-- -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain ++ Mi sitio sobre programación web: http://bits.demogracia.com +- Mi web de humor con rayos UVA: http://www.demogracia.com --
Why not just use .php instead of .html?
Because PHP will still not parse a file read with fread(), no matter
what the extension.
Could turn on output buffering, include a php file + call
output_get_clea n or use str_replace like Alvaro said
Thats if a template is necessary though, slimdizzy had a point This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ross A. Finlayson |
last post by:
Hi,
I'm scratching together an Access database. The development box is
Office 95, the deployment box Office 2003.
So anyways I am griping about forms and global variables. Say for
example I'm adding a customer. The Customer fields are mostly foreign
keys that refer to primary keys in other tables, left join instead of
junction tables at this point. So, when I want to add a customer
record, I also need to add records to the other...
|
by: Sandman |
last post by:
I dont think I understand them. I've read the section on scope in the
manual inside out.
I'm running PHP 5.2.0 Here is the code I'm working on:
//include_me.php
<?php
$MYVAR = array();
global $MYVAR, $a;
?>
|
by: jitasi |
last post by:
Hi all
I want to use the matlab function "pchip" in python.
I have checked the scipy, but there is only spline Interpolating.
Are there any pchip Interpolating in python?
Thanks
Steven
|
by: weaknessforcats |
last post by:
C++: The Case Against Global Variables
Summary
This article explores the negative ramifications of using global variables. The use of global variables is such a problem that C++ architects have called it polluting the global namespace. This article explores what happens when the global namespace becomes polluted and how to avoid this condition.
The opinions expressed in this article are those of the author alone although many have...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |