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 BLob on 03/30/06 10:52

> 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...

1. Here is what I wrote in the file :


A replacing test : id_link=%id_link%



The same in a link : http://www.example.com?id_link=%id_link%



2. Here is the RTF file (save as ... RTF using Word 2000) :



{\rtf1\ansi\ansicpg1252\uc1
\deff0\deflang1036\deflangfe1036{\fonttbl{\f0\froman\fcharset0\fprq2{\*\pano
se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2
Times New Roman CE;}{\f29\froman\fcharset204\fprq2 Times New Roman Cyr;}
{\f31\froman\fcharset161\fprq2 Times New Roman
Greek;}{\f32\froman\fcharset162\fprq2 Times New Roman
Tur;}{\f33\froman\fcharset177\fprq2 Times New Roman
(Hebrew);}{\f34\froman\fcharset178\fprq2 Times New Roman (Arabic);}
{\f35\froman\fcharset186\fprq2 Times New Roman
Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\b
lue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red
255\green255\blue0;\red255\green255\blue255;
\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\gre
en0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blu
e128;\red192\green192\blue192;}{\stylesheet{
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1036\langfe1036\cgrid\langnp1036\langfenp1036 \snext0
Normal;}{\*\cs10 \additive Default Paragraph Font;}{\*\cs15 \additive
\ul\cf2 \sbasedon10 Hyperlink;}}{\info
{\title A replacing test : id_link=%id_link%}{\author Lomitko}{\operator
Lomitko}{\creatim\yr2006\mo3\dy30\hr9\min45}{\revtim\yr2006\mo3\dy30\hr9\min
46}{\version1}{\edmins1}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company
bodka}{\nofcharsws0}{\vern8269}}
\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1417
\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\noxlattoyen\expshrtn\noultrls
pc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace18
0\dghorigin1417\dgvorigin1417\dghshow1
\dgvshow1\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ft
nlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\
lnbrkrule \fet0\sectd
\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultc
l
{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta
..}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta
..}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta
..}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl
5
\pndec\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang
{\pntxtb
(}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}\pard\plain \ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1036\langfe1036\cgrid\langnp1036\langfenp1036 {
\lang1033\langfe1036\langnp1033 A replacing test : id_link=%id_link%
\par
\par The same in a link : }{\field{\*\fldinst
{\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 }}



3. Here is the "interpreted file" :



{\rtf1\ansi\ansicpg1252\uc1
\deff0\deflang1036\deflangfe1036{\fonttbl{\f0\froman\fcharset0\fprq2{\*\pano
se 02020603050405020304}Times New Roman;}{\f28\froman\fcharset238\fprq2
Times New Roman CE;}{\f29\froman\fcharset204\fprq2 Times New Roman Cyr;}
{\f31\froman\fcharset161\fprq2 Times New Roman
Greek;}{\f32\froman\fcharset162\fprq2 Times New Roman
Tur;}{\f33\froman\fcharset177\fprq2 Times New Roman
(Hebrew);}{\f34\froman\fcharset178\fprq2 Times New Roman (Arabic);}
{\f35\froman\fcharset186\fprq2 Times New Roman
Baltic;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\b
lue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red
255\green255\blue0;\red255\green255\blue255;
\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\gre
en0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blu
e128;\red192\green192\blue192;}{\stylesheet{
\ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1036\langfe1036\cgrid\langnp1036\langfenp1036 \snext0
Normal;}{\*\cs10 \additive Default Paragraph Font;}{\*\cs15 \additive
\ul\cf2 \sbasedon10 Hyperlink;}}{\info
{\title A replacing test : id_link=123456}{\author Lomitko}{\operator
Lomitko}{\creatim\yr2006\mo3\dy30\hr9\min45}{\revtim\yr2006\mo3\dy30\hr9\min
46}{\version1}{\edmins1}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company
bodka}{\nofcharsws0}{\vern8269}}
\paperw11906\paperh16838\margl1417\margr1417\margt1417\margb1417
\deftab708\widowctrl\ftnbj\aenddoc\hyphhotz425\noxlattoyen\expshrtn\noultrls
pc\dntblnsbdb\nospaceforul\formshade\horzdoc\dgmargin\dghspace180\dgvspace18
0\dghorigin1417\dgvorigin1417\dghshow1
\dgvshow1\jexpand\viewkind1\viewscale100\pgbrdrhead\pgbrdrfoot\splytwnine\ft
nlytwnine\htmautsp\nolnhtadjtbl\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\
lnbrkrule \fet0\sectd
\linex0\headery708\footery708\colsx708\endnhere\sectlinegrid360\sectdefaultc
l
{\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang{\pntxta
..}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang{\pntxta
..}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang{\pntxta
..}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang{\pntxta )}}{\*\pnseclvl
5
\pndec\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang
{\pntxtb
(}{\pntxta )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang{\pntxtb
(}{\pntxta )}}\pard\plain \ql
\li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0
\fs24\lang1036\langfe1036\cgrid\langnp1036\langfenp1036 {
\lang1033\langfe1036\langnp1033 A replacing test : id_link=123456
\par
\par The same in a link : }{\field{\*\fldinst
{\lang1033\langfe1036\langnp1033 HYPERLINK
"http://www.example.com?id_link=123456" }{\lang1033\langfe1036\langnp1033
{\*\datafield
00d0c9ea79f9bace118c8200aa004ba90b02000000170000002900000068007400740070003a
002f002f007700770077002e006500780061006d0070006c0065002e0063006f006d003f0069
0064005f006c0069006e006b003d002500690064005f006c0069006e006b0025000000e0c9ea
79f9bace118c8200aa004ba90b
5400000068007400740070003a002f002f007700770077002e006500780061006d0070006c00
65002e0063006f006d002f003f00690064005f006c0069006e006b003d002500690064005f00
6c0069006e006b0025000000}}}{\fldrslt
{\cs15\ul\cf2\lang1033\langfe1036\langnp1033
http://www.example.com?id_link=123456}}}{\lang1033\langfe1036\langnp1033
\par
\par }}



4. When I open the interpreted file in Word I see :



A replacing test : id_link=123456



The same in a link : http://www.example.com?id_link=123456



But the link goes to http://www.example.com/?id_link=%id_link%







Any idea ?



BLob

 

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

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