Sie sind nicht angemeldet.

Douglas Rhiner

Fortgeschrittener

  • »Douglas Rhiner« ist der Autor dieses Themas

Beiträge: 141

Wohnort: San Anselmo, CA

Beruf: Code-Slave

  • Nachricht senden

1

Dienstag, 23. August 2011, 16:48

showtext single-quote or apostrophe issues

I have a php script that generates krpano XML.

When generating tooltip text I have run into an issue.

Here is the relevant script snippet:




$tooltip = "Sam's"

echo " onhover=\"showtext($tooltip,ToolTip);\"\n";




I want Sam's to be the text displayed in the tooltip popup.

However, what happens is…..Output: Sam's,ToolTip



I've tested this further and it is an issue with the single-quote or apostrophe and am pretty sure it needs to be dealt with at the JavaScript level.


Anyone have any suggestions?

2

Dienstag, 23. August 2011, 18:12

Hi,

Try this:

$tooltip = "Sam%27s"

echo " onhover=\"showtext('$tooltip',ToolTip);\"\n";


note the %27 to replace the single quote in your variable...
NOTE - to use some special characters like ',' or '<' and '>' they needed to be escape-coded in form %HH, where HH is the hex code of the character.
e.g.: ',' = %2C
and the showtext text parameter between single quotes .... without them, the output is Sam's,ToolTip ....

SAlut.

Douglas Rhiner

Fortgeschrittener

  • »Douglas Rhiner« ist der Autor dieses Themas

Beiträge: 141

Wohnort: San Anselmo, CA

Beruf: Code-Slave

  • Nachricht senden

3

Dienstag, 23. August 2011, 18:49

Thanks!
Took care of this on the PHP side.

Do you know of a full list of characters that need to be escaped in this way?

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

4

Mittwoch, 24. August 2011, 16:11

Quellcode

1
&amp;#39;
also works.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

5

Mittwoch, 24. August 2011, 16:29

Hi Sachagriffin,

It works and seems to be a better solution *smile* ....

SAlut.

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

6

Mittwoch, 24. August 2011, 17:22

Better in what way?
Now we need to figure an easier way of manipulating ampersands (txtadd).. rather than building them as a special parameter.
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

7

Mittwoch, 24. August 2011, 18:42

I mean better because your example avoids the need of the text parameter to be between single quotes. Just that....
By the way this will also work *rolleyes*:

Quellcode

1
& #38;#39;

(without the space)

SAlut.

Beiträge: 1 857

Beruf: Virtual Tours - Photography - Krpano developer

  • Nachricht senden

8

Mittwoch, 24. August 2011, 19:20

Very interesting! Too bad & #38; doesn't work in txtadd and maybe others under js.. it resolves to amp;
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour