This is a discussion on fwrite() help needed within the alt.comp.lang.php forums, part of the PHP Programming Forums category; I am trying to write to a .rtf file form a php page. I can create a temp rtf file ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I am trying to write to a .rtf file form a php page.
I can create a temp rtf file based on a template but i can only change one item on the page. I want to be able to change multiple items in the rtf file based on what has been entered in the html page eg the rtf file has [[name]] [[address]] [[phone]] I can use the str_replace to change one item but not all three any suggestions? Craig |
|
|||
|
On Thu, 18 Sep 2003 09:22:01 -0500, Craig Keightley created an
award-winning crop circle <3f69bf8a$0$254$cc9e4d1f@news.dial.pipex.com>, which, when translated into English, means this: > I am trying to write to a .rtf file form a php page. I can create a temp > rtf file based on a template but i can only change one item on the page. > I want to be able to change multiple items in the rtf file based on what > has been entered in the html page > > eg > > the rtf file has [[name]] [[address]] [[phone]] > > I can use the str_replace to change one item but not all three any > suggestions? > > Craig Perhaps you need three invokations of str_replace. All of the invokations should operate on the same string. |
|
|||
|
"Craig Keightley" <craig@sitedesign.net> wrote in message
news:<3f69bf8a$0$254$cc9e4d1f@news.dial.pipex.com> ... > > the rtf file has [[name]] [[address]] [[phone]] > > I can use the str_replace to change one item but not all three But of course you can change all three: $rtf = 'the rtf file has [[name]] [[address]] [[phone]]'; $rtf = str_replace ('[[name]]', 'Craig Keightley', $rtf); $rtf = str_replace ('[[address]]', 'craig@sitedesign.net', $rtf); $rtf = str_replace ('[[phone]]', '(987)654-3210', $rtf); Now $rtf should read like this: the rtf file has Craig Keightley craig@sitedesign.net (987)654-3210 Cheers, NC |
|
|||
|
Hey Craig,
try this $search = array ( "[[name]]", "[[address]]", "[[phone]]" ); $replace = array ( "My Name", "My Address", "My Phone" ); $rtf = str_replace ( $search, $replace, $rtf ); that's it Dima "Craig Keightley" <craig@sitedesign.net> wrote in message news:3f69bf8a$0$254$cc9e4d1f@news.dial.pipex.com.. . > I am trying to write to a .rtf file form a php page. > I can create a temp rtf file based on a template but i can only change one > item on the page. > I want to be able to change multiple items in the rtf file based on what has > been entered in the html page > > eg > > the rtf file has [[name]] [[address]] [[phone]] > > I can use the str_replace to change one item but not all three > any suggestions? > > Craig > > |
![]() |
| Thread Tools | |
| Display Modes | |
|
|