You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Online

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

#117885 HTML template code is changed when adding to an article

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Koos on Sunday, 09 August 2026 22:47 BST

Koos

I show you two pics to illustrate the problem. Code in top of the template is transferred to the bottom. 

Attachments

Ryan

Do you get the same issue if you paste the original code into the Code tab, instead of inserting it as a template?

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Koos

Short answer: No. When I put the code into the code tap everything works fine. As you can see in the pictures the editor als places <p> and </p> around the comment text. No problen here but maybe it is related. 

Ryan

Is this all the code in the template file, or is there more?

<!-- tekst en of afbeelding in linkel kolom -->
</div>
</div>
</div>
<div class-"container">
<div class="row">
<div class="col-md-3">
<p><img src="https://www.joomlacontenteditor.net/images/Ontvangers/Veronica_Caroline._City_Noordzee_en_Radio_London.webp" alt="Veronica Caroline. City Noordzee en Radio London" width="547" height="369" style="margin: 5px auto; display: block;"></p> </div>
</div>
<div class="col-md-7"><!-- einde kolom -->

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Koos

Yes, it is just an axample among others but this is the only content in this template

 

Ryan

All content inserted with template items is processed through the editor, so your invalid or incomplete HTML - it has multiple closing </div> tags without corresponding opening tag - will be "fixed", resulting in:

<p><!-- tekst en of afbeelding in linkel kolom --></p>
<div class="container">
	<div class="row">
		<div class="col-md-3">
			<p><img src="https://www.joomlacontenteditor.net/images/Ontvangers/Veronica_Caroline._City_Noordzee_en_Radio_London.webp" alt="Veronica Caroline. City Noordzee en Radio London" width="547" height="369" style="margin: 5px auto; display: block;" /></p>
		</div>
	</div>
	<div class="col-md-7"><!-- einde kolom --></div>
</div>

This is normal expected behaviour.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Koos

This is not correct. The code where it is inserted has corresponding opening tags. So the editor is correcting wrong

Ryan

The code where it is inserted has corresponding opening tags. So the editor is correcting wrong

But the code you are inserting is processed before it is inserted into the editor, so this code itself must be valid, or it will be corrected.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

Koos
Yes, I had noticed that as well. However, if that is indeed how it works, the template becomes less useful for inserting standard code snippets. In its current form, it mainly supports very basic use cases. It might be worth reconsidering whether that check is still necessary.