You are here: Re: interpolating variables « PHP Programming Language « IT news, forums, messages
Re: interpolating variables

Posted by Tim Hunt on 08/05/06 04:40

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_errormsg) ;
> >>>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_clean or use str_replace like Alvaro said

Thats if a template is necessary though, slimdizzy had a point

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация