Skip Navigation

[Resolved] How to avoid HTML entity get encoded in content template

This support ticket is created 4 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 4 replies, has 2 voices.

Last updated by poulP 4 years, 7 months ago.

Assisted by: Jamal.

Author
Posts
#1635337

Hi,
at this page (example), hidden link
I have a button that opens a gallery with user uploaded photos.
This is done by pure javascript (no jquery), and I use a content template to get the nessasary values for the script to work:
src: '[types field='stort-billede3' url='true'][/types]',
title: '[types field='titel-stort-billede3'][/types]'

In a view I have a loop with the above values for images (src and title) that are used in the script, and the view also adds the remaining js-code for the gallery to work.

But as you can see in the source I get javascript error, because the apostrophes (') are converted into html entity

‘

.
And therefor the gallery script dont work (cant load the src and title values).

How can I avoid that apostrophes are not encoded?

Best,
Anders

#1635375

I meant off course:
How can I avoid that apostrophes are encoded?

#1635587

Hello and thank you for contacting the Toolset support.

I wonder if you tested your code while omitting the single quotes:

src: [types field='stort-billede3' url='true'][/types],
title: [types field='titel-stort-billede3'][/types]

Instead of:

src: '[types field='stort-billede3' url='true'][/types]',
title: '[types field='titel-stort-billede3'][/types]'

If this does not help, please try the "raw" attribute equal to true:

[types field='stort-billede3' url='true' raw='true'][/types]

If this does not help, I might need to take a closer look at your admin area to check this further.

#1635619

Hi,
no nothing of your suggestions work.
I hope you can come up with a better suggestion. I am sorry but I can not allow access to admin area.

#1636119

I have solved it my self. Not useful support in this situation