How to enter HTML tags, javascript and PHP codes in Joomla 1.6 and 1.7?
Written by kksou   
Wednesday, 23 February 2011

Note: The following applies to Joomla 1.6 / Joomla 1.7 and above only.

By default, the Joomla editor strips away any HTML tags, javascript and PHP codes in a Joomla article.

If you are using DirectPHP, you can use the following to enter PHP codes in your article:

  1. Login as administrator.

  3. Goto Content - Article Manager.

  5. Click "Options" on the menu (the one second from the right). You should see a popup screen titled "Article Manager Options".

  7. Click the tab "Text Filters" (also second one from the right).

  9. For all Filter Groups, the default is "Black List". For the respective Filter Groups, change the Filter Type from "Black List" to "No Filtering".

  11. For example, if you are only administrator, change the Filter Type of the Super Users to "No Filtering". Leave all other remain as "Black List".

  13. Don't forget to click "Save & Close"

That's it! You should now be able to enter PHP codes in your Joomla article.

Note: The above applies to Joomla 1.6 / 1.7 and above only.

Last Updated ( Monday, 10 October 2011 )


+1 # Holger 2012-03-03 01:40
In Version 2.5.1 I reached the settings simply by using the configuration. There you should find the "Text filter" on the last tab.
# Sonyks 2012-03-10 01:19
Thanks.. i was stuck in 2.5 joomla trying to find out text filtering.
# Ingrid Wood 2012-05-24 12:59

I installed your DirectPHP plugin, and it works like a charm - thanks!

You may want to add an instruction to turn off any WYSIWYG editor; set the global config to Editor - None.

I mucked a bit around, thinking I still lost my PHP code.

# kksou 2012-05-28 07:37
Hi Ingrid,

Thanks for the tips! This will definitely help some of the people who have trouble getting this to work.

I found that depending on what you're trying to run using DirectPHP, for simple PHP statements, the default WYSIWYG editor will work just fine.

I've tried to make it work with the WYSIWYG editor because I think there are quite a number of people who feel more comfortable with the WYSIWYG editor (as opposed to the HTML mode).

In any case, if people find that the WYSIWYG editor does not work, they can always switch to the HTML mode to see if it works.

Thanks and Regards,
# papwilly 2012-06-02 10:06
Hi Kksou,

Can use DirectPHP with Ajax code as well?
# kksou 2012-06-03 18:54

First, let me emphasize again that I wrote this plugin so that I can embed PHP codes easily within a Joomla article. I thought this might be useful to others, so I decide to share this plugin with the rest on

I use DirectPHP to embed simple PHP commands. For complicated PHP commands, I will write Joomla plugins or modules - it's more efficient and easier to debug.

For Ajax, you need 2 portions - the client part and the server part. You can code the client part using DirectPHP inside your Joomla article. But for the server side, it's recommended that you code it using straight .PHP file.

# pit 2012-06-25 00:41

Thank you very much for this plugin. I get some strange error

Parse error: syntax error, unexpected $end in /users/suryoye/www/joomla/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 3

can you tell me what to do?

use joomla 2.5.4

# kksou 2012-06-25 00:46

Most likely there's some error in the PHP codes you're trying to run.

Can you list here the codes you're trying to run (if it's not too long)?

If it's too long, would suggest you copy the entire PHP codes into a standalone PHP file and use include() or require() to load the file. Then make sure you set error_display in your PHP.ini file and you will be able to see the error messages.

DirectPHP uses the standard PHP eval() function. It's almost impossible to debug as the error messages displayed does not tell you anything.

# pit 2012-06-25 01:19
Thank you for your help.

I insert the code into a txt file and uploadet. I hope you will find the strange code.

here is the file

# kksou 2012-06-26 09:36

Please refer to the following article:
Using DirectPHP - intermixing PHP with HTML commands

Also, please take a look at your PHP file. You are trying to load a standalone PHP file with its own header into a Joomla article. It won't work.

A Joomla article has its own Joomla header. Your PHP file is going to mess up the Joomla page.

DirectPHP, or any other plugin that allows you to run PHP, is for inserting simple PHP codes into a Joomla article. If you want to run complicated PHP commands, would suggest you do it using a module or component, as oppose to loading it from within an article.

# Ingrid Wood 2012-06-26 09:46
I got it to work, see:

The pbm I had in my code was that I was disconnecting from the server too soon. Let me know if you want the code.

# PeterWinkels 2012-07-05 02:27

I've installed directPHP. It works quite well, but I don't get any php Error-messages. It's a problem of Joomla in general (then: where it's possible to switch on showing error messages) or it's a problem of directPHP?

Thanks * Peter
# kksou 2012-07-07 06:21

Please google for "php.ini turn on error reporting" and you will see tons of pages that show you how to turn on the display of error messages in PHP.

However, please note that DirectPHP uses the standard PHP eval() function. If you have played with this function before, you will know that the error messages returned by eval() is not useful at all. It's almost impossible to debug based on the error messages returned by eval().

As such, if you really want to debug errors in your PHP statements, you might want to copy and paste your entire PHP scripts into a standalone .PHP file, and use DirectPHP to do a require_once() or include() to include that .PHP file. In this way, you will find that the error messages (if there's any) will be a lot more meaningful.

Once your scripts runs ok in the standalone file, you can then copy and paste the entire script back into DirectPHP.

# Upul 2012-07-22 20:34
Hi I'm working with xampp 1.7 and joomla 1.7 with tinymce editor. I have installed DirectPhp but it doesn' show the php content. It shows only "Now is:" in the sample code Now is: . I have already set text filtering to No filtering. Please help me.
# kksou 2012-07-23 04:10

Did you use the default visual editor mode or the HTML mode?

# konika 2012-10-29 04:44
Hi, Thanks a lot for the plugin, I had used it before and it worked fine on older versions of Joomla. but recently I installed Joomla ver 2.5 and then saw that PhP scripts were not working.
So I tried to install directphp for version 2.5, and got the error that there is already a folder with directphp name in plugins/content folder. So I removed the old one and reinstalled the downloaded direct Php plugin. My problem is that anything within the PHP script is not working at all- with no error I guess. Here is the sample script

Hope you can help me find the problem.Thanks
# konika 2012-10-29 04:46
# konika 2012-10-29 04:47
I guess php script are not shown here - my last try with #
# konika 2012-10-29 04:49
please delete my previous post, I was able to enable directphp and it worked. Thanks a lot
# Lens 2012-12-14 10:41
Have problem..
"Parse error: syntax error, unexpected ';' in /home/a7576657/public_html/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 6


If you can help would be nice
# sheerkoshan 2013-07-15 15:46
Dear friend
I'm using joomla2.5.8 and there is no "text filters" in article option tabs.

what should i do now?
I've installed and enabled the plugin but I can't get it worked
# kksou 2013-07-16 00:58

1) Login as adminitrator

2) Go to Site - Global Configuration.

3) Click the rightmost tab is "Text Filters"

This is the one you're looking for.

Please give it a try and let me know if everything's ok now.

< Prev   Next >

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2015. All Rights Reserved