Skip Navigation

[Resolved] HTML codes when displaying content templates

This support ticket is created 5 years, 6 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 20 replies, has 2 voices.

Last updated by Gavin 5 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#1300551
character-codes.png

Hello

Sometimes when I go to edit a view, the content templates are displaying HTML codes instead of characters...

e.g. See how ' is showing instead of a single quote? And in the screenshot, this one is displaying codes for < and >, etc.

<div class="product-slide">
<h3 align="center">[wpv-post-link]</h3>
<p align="center">([wpv-post-taxonomy type="document-type" format="name"])</p>
<div class="frame" align="center">[getpublicationpdfimg url="[types field='document' output='raw'][/types]" size="medium"]</div>
<p align="center" class="release-date">View doc in a new browser window</p>
</div>

#1300583

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Gavin, sorry I seemed to have left you hanging while tied up in another thread. Let me repeat what I wrote in the chat:

That's clearly not right.

Are these templates that were generated (e.g. using the Loop Wizard) or are they ones you manually created and edited?

I would suggest you disable all plugins except Views and switch theme to twentynineteen and see whether they remain the same (i.e. has the underlying content of the templates been changed, or is it just when presenting them the issue appears).

#1300705

Hello. They were generated using the wizard (only with one field to auto-generate the content template - then they were coded by hand). They looked okay to start with. It was only when re-opening the view that they displayed code. I 'think' that saving them they still work okay (will double-check). It's just reading them becomes a bit tricky. You think they'd display code for all of it and not just the single quotes...

I will try disabling and re-opening, re-creating, etc. and report back in due course.

#1301395

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

OK, let me just mark this as awaiting an update from you...

#1301677

Sorry for the delay in replying.

I disabled all plugins apart from Views, switched to 2019 Theme and the issue persisted.

Could it be that it's using an apostrophe (') instead of a single quote (’) ?

#1302663

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2019-07-29 at 08.56.34.png

Hi Gavin

Sorry, we are not progressing much here, can we quickly establish two things, after which I'll likely need a copy of the site for debugging given that you have already tested a minimal install.

1. is the data saved correctly and only being displayed problematically, or is it saved wrongly in the first place?

Can you use phpMyAdmin or similar to inspect the database content? Go to Toolset > Content Templates and identify the ID of the template used in your View, then check the entry for that in wp_posts, where you will see the post_content stores the content of the template (see screenshot).

2. Any errors or warnings in your debug.log?

Can I get a copy of your site (with Duplicator, or All-in-One WP Migration)?

I'll mark your next reply as private for you to share a link to the archive files.

#1305327

Also... as you have the archive, etc. I will mention this here. I have a more pressing issue. I am happy to raise this as a separate support thread.

----

The block editor is not working. For my all post types I had set them to Classic Editor (which of course without the Classic Editor plugin means that it is HTML only). I now wanted a user to be able to use the Visual or Block Editor, so I switched a custom post type to use the Block Editor, which after taking some time to load, would only let me edit the title and a 'Classic Block'. I could not add any other blocks at all. I tried with other post types including the WordPress default post type.

I then tried installing the Classic Editor plugin to see if I could use the Visual classic editor. However, with Classic Editor set, no Visual option appeared when editing any post type.

So.. I did the usual. I deactivated ALL plugins and switched to the WordPress 2019 Theme, however the problem still persists. The Block Editor has only title and Classic block with no options to add new blocks, etc. I tried the Classic Editor Plugin but no visual editor option became available.

It looks like something has got corrupted?

----

Thanks

Gavin

#1305583

Actually...

if I edit the content template in the View and then save the view it does then store the HTML codes in the database and the content template does not render correctly.

If I don't edit the content template in the view and save the view then the content template is not updated in the database and therefore still renders correctly.

#1305685

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Gavin

I downloaded the duplicate, but you omitted the installer.php file that I need to be able to install it, could you share a link to that please?

I'll look at both the issues...

#1306065

Oops! Apologies. Thank you.

Here you go...

hidden link

#1306393

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2019-08-01 at 09.21.10.png

Hi Gavin

I installed the duplicate locally and I can't see either of the issues you are reporting.

I looked at several of your Views, and identified the one your first screenshot was from, and they display entirely normally, no HTML entities visible.

I also went to Toolset > Post types and changed the settings for posts ("News") to use the Block Editor.

I then edited an existing post—it's expected to see the current content in a classic block—but I was able to add new blocks without any problems (screenshot).

Also, I'm not sure what you mean by your "of course" comment about the classic editor being HTML-only. When the post type is set to use the classic editor then both the Visual and Text tabs for the content are available as normal. No Classic Editor plugin required to change anything here.

So I don't think the site content or database are corrupted in any way, it looks to be problems occurring at the server level (given that I installed a replica of your site on a different server where it works normally).

The only thing of any note in your debug info is that you are using one of the latest PHP versions (7.3.7).

Does it make any difference if you change the PHP version to, say, 7.2?

#1306407

Thanks Nigel. That's very useful (and reassuring) to know! I appreciate the time you've put into this.

We've had a lot of issues with our ISP here on Ascension although I've not had any previous problems with the hosting which is in the UK.

I will go and change the PHP version to see if that makes a difference.

#1306421

I tried PHP 7.2 and 7.1 and no difference. I also tried a different browser.

#1306425

And you didn't toggle anything or switch anything - it just worked for you out of the tin on your install?

Very odd... I will try another site I worked on from here and see if I have the same issue.

#1306431

The other site, although using a different theme, is on the same hosting and works fine... I can use block editor or classic switching between visual and text.