473,668 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create a dynamic link in a RTF document

Hi,

I need to create an RTF document with PHP. Actually, I am using an already
created RTF document which with strings like %var% that I replace with $var
before sending the document. I need to create a link like
http://www.example.com/id_content=125 but my problem is that in the document
produced :

I can read http://www.example.com/id_content=125
But if I click on the link it goes to
http://www.example.com/id_content=%id_content%

Does anyone have the syntax on how to create links in RTF ?

Thanks

BLob
Mar 29 '06 #1
4 9581
On Wed, 29 Mar 2006 09:12:31 +0200, BLob wrote:
I need to create an RTF document with PHP. Actually, I am using an already
created RTF document which with strings like %var% that I replace with
$var before sending the document. I need to create a link like
http://www.example.com/id_content=125 but my problem is that in the
document produced :

I can read http://www.example.com/id_content=125 But if I click on the
link it goes to http://www.example.com/id_content=%id_content%

Does anyone have the syntax on how to create links in RTF ?


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.

Post both here for more help...
AJ
--
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

Mar 29 '06 #2
> 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_lin k%

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\ans icpg1252\uc1
\deff0\deflang1 036\deflangfe10 36{\fonttbl{\f0 \froman\fcharse t0\fprq2{\*\pan o
se 020206030504050 20304}Times New Roman;}{\f28\fr oman\fcharset23 8\fprq2
Times New Roman CE;}{\f29\froma n\fcharset204\f prq2 Times New Roman Cyr;}
{\f31\froman\fc harset161\fprq2 Times New Roman
Greek;}{\f32\fr oman\fcharset16 2\fprq2 Times New Roman
Tur;}{\f33\from an\fcharset177\ fprq2 Times New Roman
(Hebrew);}{\f34 \froman\fcharse t178\fprq2 Times New Roman (Arabic);}
{\f35\froman\fc harset186\fprq2 Times New Roman
Baltic;}}{\colo rtbl;\red0\gree n0\blue0;\red0\ green0\blue255; \red0\green255\ b
lue255;\red0\gr een255\blue0;\r ed255\green0\bl ue255;\red255\g reen0\blue0;\re d
255\green255\bl ue0;\red255\gre en255\blue255;
\red0\green0\bl ue128;\red0\gre en128\blue128;\ red0\green128\b lue0;\red128\gr e
en0\blue128;\re d128\green0\blu e0;\red128\gree n128\blue0;\red 128\green128\bl u
e128;\red192\gr een192\blue192; }{\stylesheet{
\ql \li0\ri0\widctl par\aspalpha\as pnum\faauto\adj ustright\rin0\l in0\itap0
\fs24\lang1036\ langfe1036\cgri d\langnp1036\la ngfenp1036 \snext0
Normal;}{\*\cs1 0 \additive Default Paragraph Font;}{\*\cs15 \additive
\ul\cf2 \sbasedon10 Hyperlink;}}{\i nfo
{\title A replacing test : id_link=%id_lin k%}{\author Lomitko}{\opera tor
Lomitko}{\creat im\yr2006\mo3\d y30\hr9\min45}{ \revtim\yr2006\ mo3\dy30\hr9\mi n
46}{\version1}{ \edmins1}{\nofp ages1}{\nofword s0}{\nofchars0} {\*\company
bodka}{\nofchar sws0}{\vern8269 }}
\paperw11906\pa perh16838\margl 1417\margr1417\ margt1417\margb 1417
\deftab708\wido wctrl\ftnbj\aen ddoc\hyphhotz42 5\noxlattoyen\e xpshrtn\noultrl s
pc\dntblnsbdb\n ospaceforul\for mshade\horzdoc\ dgmargin\dghspa ce180\dgvspace1 8
0\dghorigin1417 \dgvorigin1417\ dghshow1
\dgvshow1\jexpa nd\viewkind1\vi ewscale100\pgbr drhead\pgbrdrfo ot\splytwnine\f t
nlytwnine\htmau tsp\nolnhtadjtb l\useltbaln\aln tblind\lytcalct blwd\lyttblrtgr \
lnbrkrule \fet0\sectd
\linex0\headery 708\footery708\ colsx708\endnhe re\sectlinegrid 360\sectdefault c
l
{\*\pnseclvl1\p nucrm\pnstart1\ pnindent720\pnh ang{\pntxta
..}}{\*\pnseclv l2\pnucltr\pnst art1\pnindent72 0\pnhang{\pntxt a
..}}{\*\pnseclv l3\pndec\pnstar t1\pnindent720\ pnhang{\pntxta
..}}{\*\pnseclv l4\pnlcltr\pnst art1\pnindent72 0\pnhang{\pntxt a )}}{\*\pnseclvl
5
\pndec\pnstart1 \pnindent720\pn hang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl 6\pnlcltr\pnsta rt1\pnindent720 \pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl 7\pnlcrm\pnstar t1\pnindent720\ pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl 8\pnlcltr\pnsta rt1\pnindent720 \pnhang
{\pntxtb
(}{\pntxta )}}{\*\pnseclvl 9\pnlcrm\pnstar t1\pnindent720\ pnhang{\pntxtb
(}{\pntxta )}}\pard\plain \ql
\li0\ri0\widctl par\aspalpha\as pnum\faauto\adj ustright\rin0\l in0\itap0
\fs24\lang1036\ langfe1036\cgri d\langnp1036\la ngfenp1036 {
\lang1033\langf e1036\langnp103 3 A replacing test : id_link=%id_lin k%
\par
\par The same in a link : }{\field{\*\fld inst
{\lang1033\lang fe1036\langnp10 33 HYPERLINK
"http://www.example.com ?id_link=%id_li nk%" }{\lang1033\lan gfe1036\langnp1 033
{\*\datafield
00d0c9ea79f9bac e118c8200aa004b a90b02000000170 000002900000068 007400740070003 a
002f002f0077007 70077002e006500 780061006d00700 06c0065002e0063 006f006d003f006 9
0064005f006c006 9006e006b003d00 2500690064005f0 06c0069006e006b 0025000000e0c9e a
79f9bace118c820 0aa004ba90b
540000006800740 0740070003a002f 002f00770077007 7002e0065007800 61006d0070006c0 0
65002e0063006f0 06d002f003f0069 0064005f006c006 9006e006b003d00 2500690064005f0 0
6c0069006e006b0 025000000}}}{\f ldrslt
{\cs15\ul\cf2\l ang1033\langfe1 036\langnp1033
http://www.example.com ?id_link=%id_li nk%}}}{\lang103 3\langfe1036\la ngnp1033
\par
\par }}

3. Here is the "interprete d file" :

{\rtf1\ansi\ans icpg1252\uc1
\deff0\deflang1 036\deflangfe10 36{\fonttbl{\f0 \froman\fcharse t0\fprq2{\*\pan o
se 020206030504050 20304}Times New Roman;}{\f28\fr oman\fcharset23 8\fprq2
Times New Roman CE;}{\f29\froma n\fcharset204\f prq2 Times New Roman Cyr;}
{\f31\froman\fc harset161\fprq2 Times New Roman
Greek;}{\f32\fr oman\fcharset16 2\fprq2 Times New Roman
Tur;}{\f33\from an\fcharset177\ fprq2 Times New Roman
(Hebrew);}{\f34 \froman\fcharse t178\fprq2 Times New Roman (Arabic);}
{\f35\froman\fc harset186\fprq2 Times New Roman
Baltic;}}{\colo rtbl;\red0\gree n0\blue0;\red0\ green0\blue255; \red0\green255\ b
lue255;\red0\gr een255\blue0;\r ed255\green0\bl ue255;\red255\g reen0\blue0;\re d
255\green255\bl ue0;\red255\gre en255\blue255;
\red0\green0\bl ue128;\red0\gre en128\blue128;\ red0\green128\b lue0;\red128\gr e
en0\blue128;\re d128\green0\blu e0;\red128\gree n128\blue0;\red 128\green128\bl u
e128;\red192\gr een192\blue192; }{\stylesheet{
\ql \li0\ri0\widctl par\aspalpha\as pnum\faauto\adj ustright\rin0\l in0\itap0
\fs24\lang1036\ langfe1036\cgri d\langnp1036\la ngfenp1036 \snext0
Normal;}{\*\cs1 0 \additive Default Paragraph Font;}{\*\cs15 \additive
\ul\cf2 \sbasedon10 Hyperlink;}}{\i nfo
{\title A replacing test : id_link=123456} {\author Lomitko}{\opera tor
Lomitko}{\creat im\yr2006\mo3\d y30\hr9\min45}{ \revtim\yr2006\ mo3\dy30\hr9\mi n
46}{\version1}{ \edmins1}{\nofp ages1}{\nofword s0}{\nofchars0} {\*\company
bodka}{\nofchar sws0}{\vern8269 }}
\paperw11906\pa perh16838\margl 1417\margr1417\ margt1417\margb 1417
\deftab708\wido wctrl\ftnbj\aen ddoc\hyphhotz42 5\noxlattoyen\e xpshrtn\noultrl s
pc\dntblnsbdb\n ospaceforul\for mshade\horzdoc\ dgmargin\dghspa ce180\dgvspace1 8
0\dghorigin1417 \dgvorigin1417\ dghshow1
\dgvshow1\jexpa nd\viewkind1\vi ewscale100\pgbr drhead\pgbrdrfo ot\splytwnine\f t
nlytwnine\htmau tsp\nolnhtadjtb l\useltbaln\aln tblind\lytcalct blwd\lyttblrtgr \
lnbrkrule \fet0\sectd
\linex0\headery 708\footery708\ colsx708\endnhe re\sectlinegrid 360\sectdefault c
l
{\*\pnseclvl1\p nucrm\pnstart1\ pnindent720\pnh ang{\pntxta
..}}{\*\pnseclv l2\pnucltr\pnst art1\pnindent72 0\pnhang{\pntxt a
..}}{\*\pnseclv l3\pndec\pnstar t1\pnindent720\ pnhang{\pntxta
..}}{\*\pnseclv l4\pnlcltr\pnst art1\pnindent72 0\pnhang{\pntxt a )}}{\*\pnseclvl
5
\pndec\pnstart1 \pnindent720\pn hang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl 6\pnlcltr\pnsta rt1\pnindent720 \pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl 7\pnlcrm\pnstar t1\pnindent720\ pnhang{\pntxtb
(}{\pntxta )}}{\*\pnseclvl 8\pnlcltr\pnsta rt1\pnindent720 \pnhang
{\pntxtb
(}{\pntxta )}}{\*\pnseclvl 9\pnlcrm\pnstar t1\pnindent720\ pnhang{\pntxtb
(}{\pntxta )}}\pard\plain \ql
\li0\ri0\widctl par\aspalpha\as pnum\faauto\adj ustright\rin0\l in0\itap0
\fs24\lang1036\ langfe1036\cgri d\langnp1036\la ngfenp1036 {
\lang1033\langf e1036\langnp103 3 A replacing test : id_link=123456
\par
\par The same in a link : }{\field{\*\fld inst
{\lang1033\lang fe1036\langnp10 33 HYPERLINK
"http://www.example.com ?id_link=123456 " }{\lang1033\lan gfe1036\langnp1 033
{\*\datafield
00d0c9ea79f9bac e118c8200aa004b a90b02000000170 000002900000068 007400740070003 a
002f002f0077007 70077002e006500 780061006d00700 06c0065002e0063 006f006d003f006 9
0064005f006c006 9006e006b003d00 2500690064005f0 06c0069006e006b 0025000000e0c9e a
79f9bace118c820 0aa004ba90b
540000006800740 0740070003a002f 002f00770077007 7002e0065007800 61006d0070006c0 0
65002e0063006f0 06d002f003f0069 0064005f006c006 9006e006b003d00 2500690064005f0 0
6c0069006e006b0 025000000}}}{\f ldrslt
{\cs15\ul\cf2\l ang1033\langfe1 036\langnp1033
http://www.example.com ?id_link=123456 }}}{\lang1033\l angfe1036\langn p1033
\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



Mar 30 '06 #3
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\lang fe1036\langnp10 33 HYPERLINK
"http://www.example.com ?id_link=%id_li nk%"
}{\lang1033\lan gfe1036\langnp1 033 {\*\datafield
00d0c9ea79f9bac e118c8200aa004b a90b02000000170 000002900000068 007400740070003 a
002f002f0077007 70077002e006500 780061006d00700 06c0065002e0063 006f006d003f006 9
0064005f006c006 9006e006b003d00 2500690064005f0 06c0069006e006b 0025000000e0c9e a
79f9bace118c820 0aa004ba90b
540000006800740 0740070003a002f 002f00770077007 7002e0065007800 61006d0070006c0 0
65002e0063006f0 06d002f003f0069 0064005f006c006 9006e006b003d00 2500690064005f0 0
6c0069006e006b0 025000000}}}{\f ldrslt
{\cs15\ul\cf2\l ang1033\langfe1 036\langnp1033
http://www.example.com ?id_link=%id_li nk%}}}{\lang103 3\langfe1036\la ngnp1033
\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:

002500690064005 f006c0069006e00 6b0025

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

Mar 30 '06 #4
> 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.
OK
Looking up the chars at http://www.lookuptables.com/ and writing the
hex chars out as four digit numbers gives me this string:

002500690064005 f006c0069006e00 6b0025

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.


Well it might help. I will try that in a little bit (have something more
urgent to do).
I will post the result here.

BLob
Mar 30 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2909
by: Cindy | last post by:
hi, Can someone point me to a website where I can find a "create dynamic rows" javascript that work for IE, NS6 & NS7? Thank You. regards, Cindy
7
25891
by: Cindy | last post by:
"kaeli" <infinite.possibilities@NOSPAMatt.net> wrote in message news:MPG.197482677bbc284b989702@nntp.lucent.com... > In article <bed8e3$m6r$1@mawar.singnet.com.sg>, stayhardsg@yahoo.com.sg > shared the illuminating thought... > > hi, > > > > Can someone point me to a website where I can find a "create dynamic rows" > > javascript that work for IE, NS6 & NS7? > >
1
2275
by: brian | last post by:
This is the first time I have tried to create dynamic controls. I am trying to create a hyperlink control. The control will display properly but the event isn't triggered. I read a lot of stuff pertaining to this topic but have not been able to figure out my problem. TEST() is processed when I click a command button which creates the dynamci link buttons. The dynamic link buttons display fine but have no event when clicked.
3
12359
by: sloesch | last post by:
I am working with VS.net 2003, framework 1.1, developing with VB.net, and ASP.net, and I would like to know how you can create a dynamic hyperlink on the fly to a document stored in a SQL database? I would like to create a VB.net function that would do this, and I found this class *System.Web.UI.WebControls.HyperLink*, but I can not find any examples on generate a dynamic hyperlink. Basically, I want my function to generate an embedded...
0
2776
by: UtilityWarrior | last post by:
If you use Visual Basic 6 or VB.net and want to create PDFs from images royalty free then this DLL is for you. The Image to PDF Dynamic Link Library (DLL) will convert one or more images (JPEG, TIFF, PNG, GIF, BMP, PCX and TGA) into a PDF document. Supports multi-image TIFFs and animated GIFs. You can add clickable image stamps (eg company logo to web site), passwords, bookmarks and can even create simple full screen PDF slideshows -...
2
2102
by: UtilityWarrior | last post by:
If you use C and want to create PDFs from images royalty free then this DLL is for you. The Image to PDF Dynamic Link Library (DLL) will convert one or more images (JPEG, TIFF, PNG, GIF, BMP, WMD, EMF, PCX and TGA) into a PDF document. Supports multi-image TIFFs and animated GIFs. You can add clickable image stamps (eg company logo to web site),
1
2073
by: Jordan | last post by:
Can someone point me in the direction of a method/solution for generating word documents on the fly? I have been programming my files in rtf, but the filesize gets tooo big when I start using images and tables. I really need to have word format. I've seen programs like aspose.words. How is that? Does anyone have any "free" suggestions?
12
2824
by: prashant | last post by:
hi, i am trying to create an xml tag ref to hold link.php?id=1; or link.php?id=2 and so on. I want the links for all the fields(id) in the databse so that when i call them in my html page for google maps i have the whole link.The tag in the php page i am using is echo 'ref="link.php?id='.$row . '"'; the tag in html is <a href="+ref+">" +"more info"+ "</a>"
4
4871
by: Michael Munch | last post by:
Hi I want to read the value of af text-field, create dynamic, in a form. Se below a small test-site to do that (but readning fails): I use the function Test_Read for reading the value from the dynamic create text-field "txtName". I thanks...
0
8367
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8889
Oralloy
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...
0
8650
tracyyun
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...
1
6206
isladogs
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...
0
5677
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();...
0
4372
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2781
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.