How to enter HTML tags, javascript and PHP codes in Joomla 2.5?
Written by kksou   
Thursday, 26 January 2012

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

  1. Login as administrator.
  2. Goto Global Configuration.
  3. Click the tab "Text Filters" (first one from the right).
  4. For all Filter Groups, the default is "Black List". For the respective Filter Groups, change the Filter Type from "Black List" to "No Filtering".
  5.  

  6. 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".
  7.  

  8. Don't forget to click "Save & Close"
  9.  

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

Note: The above applies to Joomla 2.5 and above only.


 

Comments  

 
+2 # Phoebez 2012-01-27 21:59
And don't forget to enable the plug in so you don't feel foolish for half an hour like I did. :oops:
Reply | Reply with quote | Quote
 
 
# azerty989 2012-02-02 16:53
Hey,

It does work for me, I have joomla 2.5.1, and did set up as above.
- plug in is published;
- text filters in global config sets up to "no filter";

after typing into the article:

the editor uses html comments like :

Is direct php working for 2.5.1 ? or I forgot to do something else?
Thank you
Reply | Reply with quote | Quote
 
 
# azerty989 2012-02-02 16:54
Sorry all,

I forgot "NOT" in my previous comment.
It does NOT work for me with joomla 2.5.1.

Looking forward to hearing from you guys.
Reply | Reply with quote | Quote
 
 
# azerty989 2012-02-02 17:05
Never mind it seems to work now.
I figured out that you cannot type your code into the html source editor.
copy and paste the php code straight into the editor and it works.
Reply | Reply with quote | Quote
 
 
# kksou 2012-02-02 17:11
Hi,

Yes, you should enter the code in the WYSIWYG editor. DO NOT click the "HTML" button and enter the code in the html source editor.

Regards,
/kksou
Reply | Reply with quote | Quote
 
 
# Wooshtek 2012-02-07 00:35
Can a it do PHP forms like e.g. registration form? If yes, can provide a sample code.
Reply | Reply with quote | Quote
 
 
# kksou 2012-02-07 01:26
Hi,

Please refer to: How to display and process forms in a Joomla article using DirectPHP?

http://www.kksou.com/php-gtk2/Joomla/How-to-display-and-process-forms-in-a-Joomla-article-using-DirectPHP.php

Regards,
/kksou
Reply | Reply with quote | Quote
 
 
# sunanda 2012-02-22 22:16
after entering code into article where should we check the output of php file
Reply | Reply with quote | Quote
 
 
# kksou 2012-02-22 22:22
Hi,

I suppose you are referring to using DirectPHP.

This is a plugin. As name suggests, it's for use within a Joomla article.

So try entering
echo "test123";
in an article.

You should be able to see "test123" somewhere in your article.

Once you see that it works, you can slowly add more complicated PHP commands within your article.

Regards,
/kksou
Reply | Reply with quote | Quote
 
 
# double-dee 2012-02-27 19:01
I have to enter in the php open tag on every line. Is this the intended design or am have not configured the plugin fully.
Reply | Reply with quote | Quote
 
 
# kksou 2012-02-27 19:04
Hi,

Have you tried using multi-lines? It should work.

If not, what's the error messages that you see on the screen?

Regards,
/kksou
Reply | Reply with quote | Quote
 
 
# double-dee 2012-02-27 19:14
No error message. The php code is displayed.
Is multi-lines a settings?
Reply | Reply with quote | Quote
 
 
# kksou 2012-02-27 23:48
Hi,

Are you saying that if you enter:
echo 'test123';

It works ok.

But if you enter:
echo 'this is line1';
echo 'this is line2';

Can you show me the URL displaying the 2 lines above, i.e.
echo 'this is line1';
echo 'this is line2';

It doesn't work?

Also, what are the PHP commands that you are trying to run?

Regards,
/kksou
Reply | Reply with quote | Quote
 
 
# Shaun 2012-04-19 06:40
Hi,

Nice little tool but the \ of "\n" for newline is being stripped out of my code. I've turned filtering off. Anything else I can do?

Thanks, Shaun
Reply | Reply with quote | Quote
 
 
# kksou 2012-04-23 07:11
Hi,

If you take a look at the source code, there's no lines that strip the \n. So guess it's by the Joomla editor.

You might want to try some other Joomla editor that allows direct editing in raw HTML.

By the way, why would you need the \n? They are "transparent" in an HTML page, isn't it?

Regards,
/kksou
Reply | Reply with quote | Quote
 
 
# Mortenjs 2012-05-02 05:57
Hi I have tried to paste in this line.

Portfirmaet.dk Anmeldelser

Should it work with this module/plugin?
Reply | Reply with quote | Quote
 

Add comment


Security code
Refresh

< Prev   Next >

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2012. kksou.com. All Rights Reserved