Menu

Joomla Blog

Tutorials, reviews, case studies and other tips to help website owners and website developers master the Joomla content management system.

Adding code to an article

Updated for Joomla 2.5

I have received several inquiries asking how to add raw HTML code to an article. Sometimes you might like to incorporate Flash, JavaScript or other HTML code into a Joomla article but find that the code is stripped or altered when you save the article. This is a safety mechanism built-in to the HTML editor to prevent you or anyone you allow to write articles from inserting bad or malicious code. If you are using the standard HTML editor that is supplied with Joomla, you can turn off this mechanism as follows:

Joomla 2.5:

The instructions for TinyMCE as it appears with Joomla 2.5 are for the most part very similar to the Joomla 1.5 instructions. There is no longer a Code Cleanup setting, and some of the Advanced settings are different as well, but you can follow the instructions listed below. Just make sure that Entity Encoding is set to raw, and your Prohibited Elements aren't stripping out what you're trying to include, such as iframes.

Here's a screen shot of the newer version:

insert code1

 

Joomla 1.5

  1. Login to Administrator
  2. Go to Extensions - Plugin Manager
  3. Find the plugin called Editor - Tiny MCE and click its title to go into Edit mode
  4. Have a look at the parameters on the right hand side and make sure Code Cleanup on Startup is set to Off, change Code cleanup on save to Never and make sure Entity Encoding is set to raw (see image below). Further down, ensure that there are no desired tags in Prohibited Elements.
  5. Save using the button in the top right

When you next write or edit an article, click the HTML button in the editor and insert your HTML code. When you save the article, the HTML code you inserted will be preserved.

How to prevent Joomla from stripping HTML code

Rate this blog entry:
Viewing template positions
Joomla Showcase

Related Posts

 

Comments

No comments made yet. Be the first to submit a comment

Free Joomla TutorialLearn Joomla for free with our 16 lesson, 2 hour course.

Get Started