You are here: Re: How to create a dynamic link in a RTF document « PHP Programming Language « IT news, forums, messages
Re: How to create a dynamic link in a RTF document

Posted by Andy Jeffries on 03/30/06 11:52

On Thu, 30 Mar 2006 09:52:35 +0200, BLob wrote:

>> There's either something wrong with your replacing code (it's not
>> replacing all occurrences) or RTF files encode links differently. RTF
>> files are text files, try opening it and searching for "id_content=" to
>> see how the link is formatted.
>
> It does replace all the occurences of the %id_content%, but the link still
> does not work. There is something strange in the part of the RTF file
> dedicated to the link.
>
>> Post both here for more help...
>
> 2. Here is the RTF file (save as ... RTF using Word 2000) :

<snip stuff that wasn't necessary...>

> {\lang1033\langfe1036\langnp1033 HYPERLINK
> "http://www.example.com?id_link=%id_link%"
> }{\lang1033\langfe1036\langnp1033 {\*\datafield
> 00d0c9ea79f9bace118c8200aa004ba90b02000000170000002900000068007400740070003a
> 002f002f007700770077002e006500780061006d0070006c0065002e0063006f006d003f0069
> 0064005f006c0069006e006b003d002500690064005f006c0069006e006b0025000000e0c9ea
> 79f9bace118c8200aa004ba90b
> 5400000068007400740070003a002f002f007700770077002e006500780061006d0070006c00
> 65002e0063006f006d002f003f00690064005f006c0069006e006b003d002500690064005f00
> 6c0069006e006b0025000000}}}{\fldrslt
> {\cs15\ul\cf2\lang1033\langfe1036\langnp1033
> http://www.example.com?id_link=%id_link%}}}{\lang1033\langfe1036\langnp1033
> \par
> \par }}

OK, you can see two clear text versions of %id_link% and both of them get
replaced. So my next starting point was that big block of hex data in
between. Noticing there's a whole lot of double zeros in there it seems
likely that they're using 4 hex digits to encode a char.

Looking up the chars at http://www.lookuptables.com/ and writing the
hex chars out as four digit numbers gives me this string:

002500690064005f006c0069006e006b0025

That string appears twice within the datafield. I haven't tried it, but
I'd say give it a second str_replace and use that as the field to replace
(but remember to convert your ID in to 4-digit hex numbers.

Hope that helps.

Cheers,


Andy


--
Andy Jeffries MBCS CITP ZCE | gPHPEdit Lead Developer
http://www.gphpedit.org | PHP editor for Gnome 2
http://www.andyjeffries.co.uk | Personal site and photos

 

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

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