Inserting PHP and JavaScript code in Joomla 1.6 articles

This board for support questions on Joomla 1.6 RC (= Release Candidate - which should NOT be used on a production server) is NO longer active because Joomla 1.6.0 has been released.

>> For Joomla! 1.6 Support Questions, please use http://forum.joomla.org/viewforum.php?f=614 instead <<
Locked
RisingHawk
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Mon Sep 07, 2009 5:28 am

Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by RisingHawk » Fri Oct 29, 2010 7:28 am

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?

jhobart
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Jan 21, 2011 6:27 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by jhobart » Fri Jan 21, 2011 6:34 pm

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

francky13
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Jan 24, 2011 4:32 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by francky13 » Mon Jan 24, 2011 4:41 pm

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

jhobart
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Jan 21, 2011 6:27 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by jhobart » Mon Jan 24, 2011 4:53 pm

Article Manager --> Options --> Set Filter Groups

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

francky13
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Jan 24, 2011 4:32 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by francky13 » Mon Jan 24, 2011 10:15 pm

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

jhobart
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Jan 21, 2011 6:27 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by jhobart » Mon Jan 24, 2011 10:31 pm

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

walkerm88
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun Jan 30, 2011 11:55 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by walkerm88 » Mon Jan 31, 2011 12:02 am

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>

walkerm88
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Sun Jan 30, 2011 11:55 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by walkerm88 » Mon Jan 31, 2011 12:32 am

oops, my bad. The <script> tag is only stripped when saving without the TinyMCE editor (ie Global Config is set to use no editor).

tedly
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Feb 07, 2011 3:58 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by tedly » Mon Feb 07, 2011 4:43 pm

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

scutec
Joomla! Apprentice
Joomla! Apprentice
Posts: 11
Joined: Mon Feb 02, 2009 11:08 am

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by scutec » Wed Feb 09, 2011 7:46 pm

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

tedly
Joomla! Fledgling
Joomla! Fledgling
Posts: 2
Joined: Mon Feb 07, 2011 3:58 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by tedly » Wed Feb 09, 2011 8:44 pm

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

moomoochoo
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Sat Mar 07, 2009 1:18 pm

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by moomoochoo » Sun Feb 13, 2011 2:44 pm

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

User avatar
jmgroud
Joomla! Apprentice
Joomla! Apprentice
Posts: 25
Joined: Fri Apr 22, 2011 9:16 pm
Location: Paris (France)
Contact:

Re: Inserting PHP and JavaScript code in Joomla 1.6 articles

Post by jmgroud » Fri Apr 22, 2011 9:23 pm

Hello
Maybe it's possible to use the plugin 'jumi' (http://edo.webmaster.am/jumi)
Le peu que je sais est occulté par le trop que je ne sais pas...


Locked

Return to “Joomla! 1.6 RC Support [closed]”