You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "Douglas Rhiner" started this thread

Posts: 92

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

1

Tuesday, August 23rd 2011, 4:48pm

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?

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

2

Tuesday, August 23rd 2011, 6:12pm

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" started this thread

Posts: 92

Location: Fairfax, CA

Occupation: Code-Slave

  • Send private message

3

Tuesday, August 23rd 2011, 6:49pm

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?

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

4

Wednesday, August 24th 2011, 4:11pm

Source code

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

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

5

Wednesday, August 24th 2011, 4:29pm

Hi Sachagriffin,

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

SAlut.

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

6

Wednesday, August 24th 2011, 5:22pm

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

michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

7

Wednesday, August 24th 2011, 6:42pm

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*:

Source code

1
& #38;#39;

(without the space)

SAlut.

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

8

Wednesday, August 24th 2011, 7:20pm

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