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:
- Login as administrator.
- Goto Global Configuration.
- Click the tab "Text Filters" (first one from the right).
- For all Filter Groups, the default is "Black List". For the respective Filter Groups, change the Filter Type from "Black List" to "No Filtering".
- 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".
- 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 2.5 and above only.
|
Comments
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
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.
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.
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
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
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
Have you tried using multi-lines? It should work.
If not, what's the error messages that you see on the screen?
Regards,
/kksou
Is multi-lines a settings?
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
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
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
Portfirmaet.dk Anmeldelser
Should it work with this module/plugin?
RSS feed for comments to this post