Page 1 of 1

Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Fri Oct 29, 2010 7:28 am
by RisingHawk
I am unable to insert PHP and JavaScript code in Joomla 1.6 articles. The code gets stripped upon saving even I set the TinyMCE settings in the Plug-in Manager as follows:

Cleanup code on load: Off
Clean code on Save: Never
I've also removed javascript, iframe from Prohibited Elements.

With the above settings, I am still unable to insert PHP and/or JavaScript code in articles. Is there a way to do this in Joomla 1.6?

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Fri Jan 21, 2011 6:34 pm
by jhobart
The quickest and easiest route to including code in content is to have a spare user account set up without any editor, and include that user in a group for which there are no blacklisted tags.

You set blacklist/whitelist tags in:

Article Manager --> Options --> Set Filter Groups to No Filtering for the access level of your spare user. (Best to use a Super User account for this if you can.)

John Hobart

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Mon Jan 24, 2011 4:41 pm
by francky13
Hi,

I have exactly the same problem with joomla 1.6, i tryed all possible options (no filter with superuser, administrator ... ) this and the editors still delete java and <embed>..
editors : none, tinyMCE, artof ..

i'm the superuser and it is the default superuser account, unregistred. Do i have to registre it ?

i want to put a flv or mp4 video into an article, i try to use the JWPLAYER, and i can't put a embed or java code, all editors always delete the code as soon as i save it :-\ .

Someone have an idea ?

(sorry for my bad english)

thx

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Mon Jan 24, 2011 4:53 pm
by jhobart
Article Manager --> Options --> Set Filter Groups

You need to set the filter groups. See my earlier post.

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Mon Jan 24, 2011 10:15 pm
by francky13
Hello Jhobart,
i understood your earlier post and already done. There isn't an 'option' buttom with 1.6, there is parameters -> filter groups, and i'd put administrator and super user to "no filter".

the same for TinyMCE settings in the Plug-in Manager:

Cleanup code on load: Off
Clean code on Save: Never

And nothing change (of course i always saved when i change option !).

when i use "no editor" or artof, embed or java disapear whan i save.

Is there a cache system somewhere ? Cache is diseable into the configuration panel (off)

this thing drive me crazy !

thx

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Mon Jan 24, 2011 10:31 pm
by jhobart
Hey Mr. 13,

Can you paste the code you're trying to insert here? If that's not an option, you can send it to me at jhobart at synergycode dot com.

Thanks,
John

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Mon Jan 31, 2011 12:02 am
by walkerm88
I am having the same problem. Settings for TinyMCE are Cleanup code on load: Off
Clean code on Save: Never HTML:raw and all filters set to raw. Javascript is stripped no matter how I add it. This is the code I have been using for testing:-

Code: Select all

<p>Some text
  <span onclick="alert('hello world');">
    click me</span></p>

<p>This is how we add a 
  <a href="javascript:alert('hello world');">
    game</a></p>

<p>Some more text</p>

<script>
alert('hello world');
</script>

<p>Some more text</p>
And the result is always the same:-

Code: Select all

<p>Some text
  <span>
    click me</span></p>


<p>This is how we add a 
  <a>
    game</a></p>


<p>Some more text</p>


<p>Some more text</p>

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Mon Jan 31, 2011 12:32 am
by walkerm88
oops, my bad. The <script> tag is only stripped when saving without the TinyMCE editor (ie Global Config is set to use no editor).

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Mon Feb 07, 2011 4:43 pm
by tedly
I'm having the same issue with 1.6, trying to insert this code into an article. My code either simply appears as text, or nothing shows up at all for the article (either in the editor or on the webpage itself). I'm a total newbie here, so I'm just hoping/thinking that this is all due to my own ignorance.

I've configured tinyMCE with clean code on load=off, clean code on save=never, entity coding= raw, and I've removed all prohibited elements from the prohibited elements field (although they reappear after saving?). I've also tried setting the editor to none, and codemirror, but no luck.

I've configured the article manager settings to have no filtering for any groups (just to test). No luck.

Here' what I'm trying to paste into an article (I've tried just pasting it into the article, and pasting it in via the HTML editor link, but no change in result):

<link type="text/css" rel="stylesheet" href="/script/css/calendar.css" />
<link type="text/css" rel="stylesheet" href="/script/ajax.php?controller=calendars&action=css&cid=1" />
<script type="text/javascript" src="/script/js/custom.js"></script>
<script type="text/javascript" src="/script/js/front.js"></script>
<script type="text/javascript" src="/script/load.php?cid=1&view=3"></script>

Anything else that I should be doing? Maybe something I'm supposed to be inserting into the code besides what's shown above? The "script" directory referenced above is in the root directory where the joomla site files are installed.

Thanks in advance for the use of your brains.

Ted

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Wed Feb 09, 2011 7:46 pm
by scutec
I agree with the previous writers: Setting the article filter groups (to "no filter") doesn't work!
Bug altert?
Example:

<p>
<script src="http://lite.piclens.com/current/piclens.js" type="text/javascript"></script>
<ul class="p2">
<li> <a href="javascript:PicLensLite.start({feedUrl:'/galerij/Bonaire.rss'});" target="_parent"> Bonaire 2008 </a> </li>
</ul>
</p>

changes to:
<p> </p>
<ul class="p2">
<li> <a target="_parent"> Bonaire 2008 </a> </li>
</ul>
<p> </p>

With all the filters set to "no filter".

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Wed Feb 09, 2011 8:44 pm
by tedly
Looks like someone's looking into this bug for 1.6 (opened on Jan 22, 2011):

http://joomlacode.org/gf/project/joomla ... m_id=24545

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Sun Feb 13, 2011 2:44 pm
by moomoochoo
The patch at the bottom of the page on Tedly's link worked for my Joomla 1.6 installation.
<-- --> tags are no longer removed.
It doesn't strip my php tags either.
I'm using no editor and have given my user account no filter settings.
Simply awesome!!!! :D

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Posted: Fri Apr 22, 2011 9:23 pm
by jmgroud
Hello
Maybe it's possible to use the plugin 'jumi' (http://edo.webmaster.am/jumi)