DirectPHP - FAQs, Troubleshoot and Tips & Techniques
Written by kksou   
Thursday, 03 September 2009

This is the FAQ for the DirectPHP plugin.

Troubleshooting

  1. Q: My PHP codes are not processed.
  2. A: Did you enable the plugin? Go to Plugin Manager and make sure the plugin is enabled.

  3. Q: My PHP codes disappeared after clicking Save or Apply.
  4. A: Have you applied the following tip: How to enter HTML tags, javascript and PHP codes in Joomla 1.5.8?

  5. Q: My PHP codes disappeared after clicking Save or Apply.
  6. A: Do not use the "source button" in TinyMCE.

    Just type the codes right inside TinyMCE in the default WYSIWIG (what-you-see-is-what-you-get) mode.

Plugin Conflicts

If you've tried all of the above, and it still does not work, it might be because of conflicts with some other plugins or modules. To ascertain this,

  • Please try the plugin on a fresh install of Joomla. This will allow you to know if the plugin works on your machine at all.
  • If the plugin works on your fresh install of Joomla, then you could try add in the rest of the plugins and modules one by one until you find the one that causes the conflict.

 

Comments  

 
# murali ayyagari 2012-03-05 10:05
I have installed the plugin and is working with the examples you gave( simple php). I tried to insert code with php, html, and javascript and css. It is not showing any errors but on publishing it is just displaying the code only( except the php code ). How to correct it>
 
 
# kksou 2012-03-05 16:45
Hi,

Are you saying that the PHP codes are working, but not the HTML and javascript?

Regards,
/kksou
 
 
# murali ayyagari 2012-03-07 11:38
I have worked it out. PHP, HTML, Javascript all are working. My only problem is that my form inserts the form data into mysql table.But that is not working. Any customization i have to do in Directphp.php file for the database related code to work.
 
 
# kksou 2012-03-10 20:32
Hi,

If it's standard PHP, it should work.

What is the code that you are trying to run? What is the error messages that you see on the screen?

Regards,
/kksou
 
 
# frank the tank 2012-04-16 15:22
hi, will it work with sessions/ submitting forms ?
 
 
# hans_eat 2012-04-26 01:06
Hi kksou,

this is a great tool, which works really good for me! I just have problems getting javascript working.

The function need to be within and echo"", correct? Otherwise it displays the javasscript code, but doesn't run.

How do I need to place the javascript code correctly in order to be recognized as such by phpdirect? And how can I call the functions?

Thanks a lot! :roll:
 
 
# hans_eat 2012-04-26 01:09
Quoting hans_eat:
Hi kksou,
The function need to be within and echo"",


Sorry, it dropped the php tags in the post. I meant:

The function needs to be within and php start and end tags and 'echo " "', correct?
 
 
# Tom_P 2012-07-26 05:48
Hi, i am trying to install a latest events php file in a cusstom module, using bot_jcalpro_lat est_events.php
All the events have been entered in the calendar and are visible on the website, but i can't get the php file to work in html. Am i using the right one, if so what am i doing wrong?
 
 
# Berry G 2012-09-05 01:29
Hi there,

I installed DirectPHP on my Joomla! 1.5.22 site and tried it. Unfortunately it doesn't work. When I save the article, the is converted to ?-->. I activated the plugin and checked the TinyMCE settings to match the advised settings but still it doesn't work. How can I resolve this?
 
 
# Berry G 2012-09-05 01:31
Hi there,

I installed DirectPHP on my Joomla! 1.5.22 site and tried it. Unfortunately it doesn't work. When I save the article, the "" is converted to "?-->". I activated the plugin and checked the TinyMCE settings to match the advised settings but still it doesn't work. How can I resolve this?
Hope anyone can help
 
 
# Berry G 2012-09-05 01:36
Unfortunately my question is not clear because the php tags are removed when I post on this forum. I'm trying to say that the php tags are modified by addition of !-- The php tag then looks like this (without spaces) < !-- ? php
Hope my question is clear.....
 
 
# uzbaby 2012-11-04 20:16
Hello
please can anybody help me
I want to add some php code to new module but after adding the php code I see only THE CODE itself. What am i doing wrong?
 
 
# kksou 2012-11-04 20:39
Hi,

Based on your description, looks like you've only installed the DirectPHP module.

For the module to work, it needs the DirectPHP plugin available here: http://www.kksou.com/php-gtk2/Joomla/DirectPHP-plugin.php

Please install the plugin and test the plugin by creating a new article and entering the PHP code in the article. (please follow the instructions as outlined in the article where you download the plugin).

Once the plugin is working correctly, you can then test your code in the module.

Please give it a try one more time and let me know if it works, ok?

Regards,
/kksou
 
 
# haggisbasher 2012-11-14 08:02
Quoting Berry G:
Unfortunately my question is not clear because the php tags are removed when I post on this forum. I'm trying to say that the php tags are modified by addition of !-- The php tag then looks like this (without spaces) < !-- ? php
Hope my question is clear.....


I am also experiencing this problem. Is there a workaround?
 
 
# Berry G 2012-11-17 05:26
Quoting haggisbasher:
Quoting Berry G:
Unfortunately my question is not clear because the php tags are removed when I post on this forum. I'm trying to say that the php tags are modified by addition of !-- The php tag then looks like this (without spaces) < !-- ? php
Hope my question is clear.....


I am also experiencing this problem. Is there a workaround?


You can solve this by selecting "No Editor" in the Joomla General settings. Put the php-code in the article and save the article. Afterwards you can select TinyMCE again. But if you edit the page with php-code you must select "No Editor" again.
 
 
# Knowledge Explained 2013-04-16 10:33
Hello kksou, thank you for your plugin! I am having a weird problem with DirectPHP 2.5 under Joomla 2.5.7.

I edit my articles at the backend, and for most PHP code, if I embed it in an article and press save, it makes the backend crash. However, the article was saved correctly: it displays on the web and the and the embedded PHP works right.

I get the feeling that the process of saving the article is attempting to execute the embedded PHP snippets at that very moment, instead of just saving them as HTML or text. Could this be happening?

If it helps, I am using editor CodeMirror (code only, no WYSIWYG).
 
 
# kksou 2013-04-17 00:20
Hi,

As a test, can you switch back to the default editor that comes with standard Joomla installation and see if it's the same problem.

This will allow you to see if it's just CodeMirror giving the problem.

Does CodeMirror has a forum? If yes, maybe you can post the question there. Maybe there are already some solutions for that.

Regards,
/kksou
 
 
# Knowledge Explained 2013-04-17 02:12
Hello kksou. I have tried changing editor, but the same happens. Even when I select "no editor", which reduces input to a text box.

What happens is this:
- I copy the text to the input box
- I press save
- The page becomes blank
- I can still press "back" on the browser, and I get to continue working at the backend
- If I go to the web and see the article, it displays and its embedded PHP worked as expected.

If you need any more details, feel free to ask (maybe through email?)
 
 
# kksou 2013-04-17 02:27
Hi,

Please do one more test:

1) Uninstall DirectPHP

2) Enter some PHP codes in editor

3) Click save

Does it give any error?

If yes, it means there's nothing to do with DirectPHP. It's the editor problem.

Regards,
/kksou
 
 
# Knowledge Explained 2013-04-17 15:14
So, I tried deactivating DirectPHP. I re-saved some articles that normally made the backend go blank, and they saved without problems. When re-enabling DirectPHP, saving them again with the exact same content produces the problem again.

It seems it only happens when DirectPHP is active.
 
 
# Knowledge Explained 2013-04-18 01:10
Hi kksou, finally I wrote a fix myself that has solved the problem.

At the beginning of onContentPrepar e function I have added the following 2 lines:

if( !JFactory::getA pplication()->isSite() )
return true;

This restricts PHP code evaluation to the site (and not the backend). So it seems that my intuition was right here: PHP was getting evaluated when saving the article! Hope you can fix it for next versions. And thanks for your help.

www.knowledgeexplained.com
 
 
# kksou 2013-04-19 01:28
Hi,

Thanks much for sharing this!

It's strange, because no other users have encountered this before. You can try this on a standard Joomla template. Don't think by default the editor will run the plugins. DirectPHP is a content plugin. It should run only with content articles.

In any case, this is still useful knowledge to know. It will benefit other users if they encounter similar situation.

Thanks and Regards,
/kksou
 
 
# Knowledge Explained 2013-04-20 05:17
What made me think that, is that the crash didn't happen for all PHP code. Depending on what instructions I added to the article, it would crash or not. That's what made me suspect: For a content string, what difference would it make if my PHP is calling echo or JFactory? None. Unless the PHP insertions are getting treated as code instead.

But I may be wrong, of course. Just letting you know my thoughts on the crash.
 
 
# chandler 2013-07-02 08:19
I am trying to run sql commands and none of them seem to work.
Something as simple as creating a table with one column in it. I am not getting any errors and I am able to connect to the database but I can't do anything else.
 
 
# kksou 2013-07-02 08:27
1) Try echo "test123" first. Does it work?

2) If yes, then trying echo some debugging messages to see at which point it doesn't work.

3) How do you know that you are able to connect to the database?

4) If you are able to connect to the database, then what is not working?

5) You might need to set error_display in php.ini to display error messages.

Regards,
/kksou
 
 
# chandler 2013-07-02 08:40
I added comments to the quote
Quoting kksou:
1) Try echo "test123" first. Does it work?
yes I have "Now is: " working

2) If yes, then trying echo some debugging messages to see at which point it doesn't work.

3) How do you know that you are able to connect to the database?
I was using "(mysqli_connect _errno())" to check for errors

4) If you are able to connect to the database, then what is not working?
This is the proverbial question. Unfortunately I am trying to teach myself php and sql so there is a little bit of a learning curve.

5) You might need to set error_display in php.ini to display error messages.

Regards,
/kksou
 
 
# George123456 2013-09-12 17:53
Quoting kksou:
Hi,

Are you saying that the PHP codes are working, but not the HTML and javascript?

Regards,
/kksou


Only your php example codes are working. My script, which generates dynamic html-content is not displayed.
 
 
# kksou 2013-09-13 01:33
Hi,

Can you please email me the codes that you're trying to run?

Regards,
/kksou
 
 
# strategystar 2013-10-06 12:40
Hi, I am using your plugin for PHP code in a joomla article and it is working perfectly except one thing... the main navigation of the website is not showing on this page????
please see:
http://www.net-direct-marketing.com/index.php/ad-form
Any ideas as how to fix this or why it is happening?
 
 
# johnnybgoodwin 2013-10-22 14:41
Hi there
The plugin worked when I first installed it. Today it won't work. The .php script is shown in full in the content.
Using TinyMCE in Joomla 2.5.14 and PHP 5.3.
Like I said, it worked a couple of days ago. Nothing changed on the site....
John
 
< Prev

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