This is the FAQ for the DirectPHP plugin.
Troubleshooting
- Q: My PHP codes are not processed.
- Q: My PHP codes disappeared after clicking Save or Apply.
- Q: My PHP codes disappeared after clicking Save or Apply.
A: Did you enable the plugin? Go to Plugin Manager and make sure the plugin is enabled.
A: Have you applied the following tip: How to enter HTML tags, javascript and PHP codes in Joomla 1.5.8?
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
Are you saying that the PHP codes are working, but not the HTML and javascript?
Regards,
/kksou
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
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!
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?
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?
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?
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
Hope my question is clear.....
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?
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
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.
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).
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
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?)
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
It seems it only happens when DirectPHP is active.
At the beginning of onContentPrepare function I have added the following 2 lines:
if( !JFactory::getApplication()->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
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
But I may be wrong, of course. Just letting you know my thoughts on the crash.
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.
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
Quoting kksou:
Only your php example codes are working. My script, which generates dynamic html-content is not displayed.
Can you please email me the codes that you're trying to run?
Regards,
/kksou
please see:
http://www.net-direct-marketing.com/index.php/ad-form
Any ideas as how to fix this or why it is happening?
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
but when i create page by sppage builder and write php code . its not working . when i check code on browser in inspect element php code show in comment .\
please can you solve this problem i have very tried .
Thanks
vikash sharma
The DirectPHP plugin is a content plugin. As the name suggests, it's for use within the Article component only (which is com_content). I wrote this plugin to run simple PHP commands from within an article. It's not designed to run in other components.
The SP Page Builder is a different component by itself. It does not know all the plugins out there, and naturally it will not run DirectPHP plugin which is a content plugin.
You might want to check with the developer of SP Page Builder to see if there's anyway to trigger content plugin from within their component.
Warm Regards,
/kksou
But I nothing changed in code, just update Joomla.
My code is:
Notice: Undefined variable: colorbgsoon in Z:\home\test\www\plugins\content\DirectPHP\DirectP HP.php(58) : eval()'d code on line 1
Check my code on http://sandbox.onlinephpfunctions.com/ and it still working without errors.
I am (still) using this wonderful little tool in various projects to add php into content - as said before, I really like it!!!
However, for your info, just in case you did not yet notice the following DEPRECATION message (on PHP 7.0.7):
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; plgContentDirectPHP has a deprecated constructor in ....httpdocs/plugins/content/DirectPHP\DirectPHP.p hp on line 23
Thanks to informing me about this way back in July. It's very nice of you!
For your info, have released DirectPHP for php7: New version of DirectPHP - support for PHP 7
You can download it here: http://www.kksou.com/php-gtk2/joomla/directphp-plugin.php#download
Thanks for your long-time support for the DirectPHP plugin!
Warm Regards,
/kksou
Why can't everything be this simple?
Can't find a 'donate' link.
If I run the php outside of joomla and then copy/paste the page directly into joomla article the shortcodes work. Any ideas?
I am a longterm (very happy) user of "DirectPHP". However for getting data out of your database and embed them into articles, you may want consider my own Joomla extension jDBexport. This is a data reporting tool, where you define SQL queries in the backend, and receive the results as Excel documents (or embed them in just about any way you want).
contact me if you like to know more...
regards Ruediger
I am using your DirectPHP Plugin and it worked all fine so far. Thanks so much for providing this Plugin. However, I have no experienced a problem with PHP Mail function. Within an article I have implemented code to generate an email and send it out via Mail(). Once processing the script, nothing is happening. I am not receiving any error message, but an email has also not been sent. First I thought it could be a missing email address which I have taken out from an mysql table, but I checked this and the query worked fine and e-mail address ist correct.
Do you have any idea what the problem could be? Just for your information: The DirectPHP Plugin is ordered before the Content - Email Cloaking.
Many thanks in advance for your support.
There's no way to fix anything if you don't know exactly what's the problem. So first thing first, you need to find out what is the error message.
Joomla has no inherent debugging tool. So the only way is to enable error_display in PHP and see what exactly is the error message produced.
Also DirectPHP uses standard eval() function. So you can also copy and paste the entire code into a standalone .PHP file and see if it runs from browser or command line. If it doesn't, you can see exactly what's the error message on the screen.
You may also want to refer to the following article that I've written that contains more details:
How to debug PHP codes in DirectPHP
Hope this helps.
Warm Regards,
/kksou
Just confirm your plugin works perfectly under latest Joomla 3.8.8 and PHP 7.0. Thank you !
The only very desired feature is to enable this plugin for specific categories IDs or specific article IDs.
It would decrease a general article loading weight and increase the general safety.
With hope to a next update !
Best regards,
i'm working with directphp in Joomla 3.9.1 now and it is working fine . I use codemirror as editor, because tinymce is a pain with a lot of php code - if you want to paste or press the wrong button.
I use also php-rgraph which is a very nice tool to show my weather data graphically.
I had to reinstall my server and got updates on joomla, and other plugins...
Since that php commands do not work anymore within the {rgraph ....} tags ...
E.g.: {rgraph ... ymin="" ... } is totally ignored.
Any suggestions? Please help if you can.
Please take a look at the article
Ordering of Joomla plugins
Try to change the order of plugin so that you process DirectPHP before the php-rgraph plugin. I think the current order is such that php-rgraph is processed first followed by DirectPHP. That's why the php-rgraph tag is not processed.
Please give the above a try and let me know if it works.
Warm Regards,
/kksou
RSS feed for comments to this post