. Include PHP commands right inside your Jommla content page using the standard php construct:. Freely intermix static contents with php commands:Now is:. Leverage on all your PHP libraries right inside the content page:. You can edit the php code right inside the default TinyMCE WYSIWYG Editor!. Ability to block potentially 'risky' commands, e.g.
System, fopen, unlink, rmdir, etc. You can add and edit this list of commands-to-block yourself. DirectPHP for Joomla 1.0.x:DirectPHP for Joomla 1.5.x:DirectPHP for Joomla 1.6.x:DirectPHP for Joomla 1.7.x:DirectPHP for Joomla 2.5.x:DirectPHP for Joomla 3.0.x:Don't forget to set the Filter Type to 'No Filtering' so that you can enter PHP codes in a Joomla 1.6/1.7/2.5 articles.Note: To upgrade to the newer version, simply uninstall the old version and install the new version of the plugin. Version 1.00: released March 24, 2008. Version 1.01: released March 27, 2008.In TinyMCE Editor, when you press Enter, internally it's stored as a. If you press shift-Enter, internally it's stored as.

In v1.00, if the user presses Enter after '. Overlooked the case for. Bug has been fixed. Version 1.02: released April 6, 2008.In some of the editors, tabs is internally stored as &160. If you're using tabs for code indentation, please download this update. Version 1.03: released May 12, 2008.Encapsulate all functions used by DirectPHP within a class so that you can use DirectPHP with some other plugins such as the 'DirectPHP for Category Description' plugin.
Version 1.04: released June 21, 2008.Now supports both PHP5 and PHP4. Version 1.05: October 11, 2008Thanks to who informed me about some 'mysterious' double-byte characters that get inserted into the DirectPHP code by the content editor of some of the non-English Joomla. These double-byte characters will cause error when processing the PHP commands with eval.
Have fixed this in this version. Version 1.56: April 8, 2009Added one more parameter 'Using No Editor'. If you're not using any editor when editing content articles, select 'yes' for this parameter.
Hi,First of all, DirectPHP is not originally designed to be used to enter complicated PHP codes. I wrote it originally to allow myself to enter simple PHP codes here and there in a Joomla article. If you need to include complicated PHP codes, you might want to write a plugin for that purpose. It's cleaner and easier to debug that way.Besides, note that this is a plugin. As the name suggests, you are running PHP codes within the Joomla framework.
So NOT ALL php scripts will run within your Joomla article.If you are still keen to try DirectPHP, please try something simpler first, such as echo 'test123';This will allow you to know if DirectPHP works at all on your server.Once you are certain that DirectPHP runs on your server, you can try adding more complicated PHP commands to see if it works within your Joomla article.Again, just want to emphasize again you are running PHP script within the Joomla framework. So NOT ALL scripts will run. You need some trials and errors to test it out.Regards,/kksou. Hi,Sorry for the late reply.Let me answer your second question first. With DirectPHP, you can have dynamic contents within an article.
You can also display and process things like forms within an article. Of course, there are many things you can achieve using the method you have just mentioned, i.e. Putting the PHP into a module and then loading its position from an article. However, I think you can see that this is an 'indirect' method - as oppose to Joomla running the PHP codes directly in the article. Second, there are some things you cannot do using the 'module' method. If you are using the googleMaps plugin, I can use PHP to generate a dynamic tag to display different google maps every time depending on the user or the content.
I can also use PHP to choose which content plugins to run depending on situations.As for yoru first question, this is the reason why I put a 'Disclaimer' just before the downloading section of this page - it's powerful, but you have to use this at your own risk. (This is true for any other plugins that allow you to input PHP.) If you are the administrator for your website, and you know what you are doing, then using this is relatively safe. But if you website has many authors and publishers, then I would be a bit worried using this type of tools too.Hope this helps.Regards,/kksou. I thought I had finally solved my problem with your plugin, but I can't get it to work.I must include the php in an article so the client can modify prices later. I was using JCE editor, and switched to tinyMCE.
Site is v1.6.I followed all your instructions, set Article Manager filtering to none for Super Users and Admin. It was already set for Super Users. I inserted the script into the page it belongs on, complete with ' at the beginning and end. No other text or code was included. The script is 138 lines. Is that too long for this plugin to handle?I also tested just ' to see if a short script would work.
All I get is the entire php script, the short or long one, displaying on the page, with tags. Is this enough info to determine what I may have done wrong?. Yes, a simple 'Does DirectPHP work?' Statement does work; displays on the page just fine.
But when I paste in my 138 line script to calculate water and sewage rates, the page returns blank. I have a php form in the body of another article and direct it to my page with the php script.This exact same 138 line file works fine in a WAMP environment, serving up IE. The code returns and displays the calculations.Would there be a difference between the code a WAMP server can use and code in a Joomla article?. As the error message says, there's error in your PHP code.Your entire code is processed by the standard PHP eval statement. As such it's very difficult to debug anything from the error message.Would suggest you copy the entire PHP code into a standalone PHP file.1) First try if your standalone.php file runs at all. If it doesn't run, the error messages returned by the PHP interpreter will be more meaningful and easier to debug.2) Once your standalone PHP file runs ok, you can use DirectPHP from within your Joomla article and do a require or include to include your PHP code. See if the code now runs.3) Once (2) works, you can then try to copy and paste your PHP codes from the standalone PHP file back into the article.
See if it works.Note that even if (1) works, it does not necessarily means (2) and (3) will work. Bear in mind that you are running your codes within the Joomla framework - so not all PHP codes will run the same within Joomla.
This is particularly the case if you are using mysql that connects to another database - You have to remember to reconnect the database back to your underlying Joomla mysql database, otherwise it has no way to connect back to your Joomla environment.In any case, I wrote DirectPHP to run some simple PHP scripts. If you need to run complicated PHP scripts, would suggest you write a proper Joomla plugin or module. It's much cleaner and the codes are easier to debug.Regards,/kksou. Hi,1) Please try a simple one-liner PHP: echo 'test123';Just want to make sure that DirectPHP is running ok on your machine.2) If (1) works, and you're sure that your codes above works fine in standard PHP, then the other possibilities is that the order of DirectPHP comes before that of your other plugin 'chronoforms'.Please go to the Plugin Manager and see what's the order of DirectPHP and your other plugin chronoforms. If both are 0, please set DirectPHP to be 9, and chronoforms to be 10. If, say, the order of chronoforms is 3, then change the order of DirectPHP to be 2.The key thing is: the order of DirectPHP must go BEFORE that of chronoforms - this will ensure that DirectPHP is processed first, followed by your chronoforms plugin.Otherwise, if chronoforms is processed first, it will produce some codes which then go into DirectPHP - resulting in error because most likely chronoforms will not produce valid PHP codes.Please give it a try again and let me know if it works.Regards,/kksou.
Hi,Most Joomla users will use the default Joomla visual editor to enter simple PHP codes into their article.The default visual editor adds br to each shift-enter, and adds a pair of p and /p to each enter. These br and p tags will cause error when the PHP scripts are being processed by eval. Hence all the br and p tags are removed before passing into eval.If you know what you are doing, and you use some other editor that allows you to enter PHP/HTML codes directly into your article, then you can go to the Plugin Manager, click on DirectPHP, and in the parameter page, set 'usingnoeditor' to 'Yes'. The default is 'No' which strips away all br and p.Regards,/kksou. Hi,Does your PHP has the curl library installed?
DirectPHP doesn't run it's own PHP. It runs on top of the PHP that runs with your Joomla. So if your original PHP does not have the curl library installed, those commands will also not run using DirectPHP.If you're not sure, please do the following:First create a.php file, in there put justLoad the file in your broswer.Then check if your PHP has the curl library installed.Regards,/kksouyes i have curl installed and running (i have a joomla 1.x running in another folder wich uses the same php script but in php module ) i thought if i used a php module instead that will make it work?thank you. Hi,The module installed fine and test out OK with some simple PHP.
I'm now trying to see if I can integrate my WHMCS install into Joomla - WHMCS uses IONCube for protection.Every time I copy & paste one of the.php files from my WHMCS install into DirectPHP I get the following error:The file /var/www/html/mydomain.com/plugins/content/Direc tPHP/DirectPHP.php(58): eval'd code is corrupted.It's cool if using IONcube protected code simply doesn't work with DirectPHP, I just wondered if you knew!Thanks,Steve. Works good.I tried to use it with JCE editor.
This editor removes alle PHP code so this does not work.CKEditor comments out all PHP code. I worked around this by changing the lines 41 and 42 in 'directphp.php' as follows$phpstart = ' or '?' ;I can now use the plugin with a more sophisticated editor than tinymce.I would like anyones comment on this.(sorry I would have posted a picture if that were possible)$phpstart = ' or '?' should be$phpstart = 'comment+startPHPcode' or 'startphpcode'$phpstart = 'endcomment+endphp' or 'endphp' (I hope you know what I mean):). Hello, first of let me say this is a wonderful extension. The options this simple thing opens up, I have it on every one of my sites.Now the bad.
This extension appears to break Joomla 2.5's Smart Search. Pretty simple to verify - use DirectPHP to include some PHP on an article, then run Smart Search's Indexer. I haven't been able to make it work. Disable DirectPHP via plug-in manager and the Indexer works as expected - don't need to delete the code from the article, just disable the extension.It's easy enough to disable/re-enable it, so not a deal breaker for me. But would be a good fix!Eep.
I'm using v1.7. Maybe DirectPHP v2.5 fixed this?. Hi kksou,pls don't think I'm stupid, but I've got a problem to implement your plugin into our version of joomla.I don't know what kind of joomla we use, but it's terrible.I'm looking for answers to show my php sites correctly in joomla, but the only thing that remember me. Hey this is joomla. Is the sentence in adminpanel.' You're using Joomla 2.5'My biggest problem is, that joomla as you know it has nothing in common with the version I've found here.Not even root structure (folders and files).I hope you can help me to solve this problem.Many Thanks FabuP.S.
I also hope, that you can understand my bad english. I haven't been written a long tim in english. Hi Fabu,Sorry for the late reply, because I'm not sure if I can answer your question.If I understand correctly, you have some PHP site and you want to make this into a Joomla site.If this is correct, then I have to say that DirectPHP is not the right tool you are looking for.DirectPHP is a content plugin. As the suggests, it's for use within a Joomla article, when you need to add some PHP codes in a Joomla article.DirectPHP is NOT used for converting any PHP codes into a Joomla website.Hope this answers your question.Regards,/kksou.
Well, that didn't work out so well. Ok, to continue on (and retype it all out):I'm trying to work with images to that I can use the following type of string:img src='/php-gtk2/dailypic?php echo date('d');?.png' alt='text'Using square brackets instead of regular ones so I don't lose my comment again.I am using Joomla 3.1 with JCE for my editor (instead of TinyMCE). I copied down your date test above and can usually get it to display correctly (often Joomla will put in which seems to break things - usually you can type over this and it will then take it. Usually).When I get it to work, I can see your date code just fine and I can see the text which translates to 'dailypic19.png', but I cannot seem to get this to translate the html and the php at the same time. Is this possible with this plug-in or am I going to be hard coding my front pages so that I can get this to work?continued.
Thanks for this great plugin. Works out of the box for me.I needed this because I need to migrate a php-fusion site to a Joomla platform. I created my own member- and instruments administration application, written in php. Now I can easily migrate it to Joomla.At the end there was a little problem with the tags. I saw that these are altered within the plugin. Please can you explain a little bit to me why this is done?For now I changed some coding in DirectPHP.php functions fixstr and fixstr2 and all seems to work okay. Just wanted to say a massive THANK YOU for writing and developing DirectPHP!
With this I was able to write a simple script to access my Joomla DB to enable me to display the username of the latest person to register on my site. Also, thanks for keeping the 2.5 version up to date, my server was updated to PHP5.5 this week and I lost the use of DirectPHP, finding you have a newer version available was fantastic, it works!Thank you, and yes, I do know I should upgrade to Joomla 3 but it's a BIG complex site to migrate. I've been using DirectPHP on my sites for years with no troubles - as long as I remember to activate the plugin.:-DToday I upgraded to 2.5 (Joomla! 2.5.28), activated the plugin, set 'no filtering' - but I'm having problems. The page with the list of articles with PHP scripts won't load - it's just a blank page. If I disable those articles, it loads just fine.
I've checked everything I can think of. Having recently had some of my other sites hacked, I'm making sure this one is 'up to date' - but upgrading to DirectPHP 2.5 isn't working for me.I'm also using Jumi for less complicated scripts. Do these two play nice together? Hi kksou,I wrote you a couple of days regarding 'DirectPHP problem with Joomla 3.8.0'I'm happy to say that the problem I described is not caused by DirectPHP, it's a bug introduced with Joomla 3.8.0; it was already acknowledged and fixed from the team, see and it's due to double event firing.Following the directions in the given url it's easily fixed.Sorry for the misunderstanding:(Keep up the good work!CiaoFabrizio. Hi Steve,Happy New Year!1) Download the installation file from:Make sure you download the one for Joomla 3.0.2) Save the file to your local machine. The filename should be DirectPHPv3.01.zip3) Go to Extensions Manager - Install.4) Click the first tab 'Upload Package File'.
You can drag and drop the file 'DirectPHPv3.01.zip', or you can click the button 'browse for file'.5) Go to Extensions - Plugins and Enable the plugin.Please give the above a try and let me know if it works.Warm Regards,/kksou. /kksouI figured it out.
I was already using JCE Editor (it was installed with my joomla installation and the default editor.The solution:go to components - JCD Editor - Editor Profilesopen the default profilego to editor parameters - advancedset 'allow php' to 'yes'.when editin and article, code now saves and displays in the code window.Side note: I created a separate profile in JCE for super users (I didn't want to give php ability to all users). I duplicated the default profile, set it for super users only (this is done on the setup tab after clicking on the profile).Cheers,Mark.
Hi Mark,Sorry for the late reply. Recently there has been a huge influx of spam posts, and your post was buried among them.First, please bear in mind that not all PHP libraries can run within the Joomla framework. For each article, it actually run through many layers of complicated plugins, modules and components before it gets displayed in your browser. Sometimes there are conflicts between the underlying Joomla PHP core and your other PHP libraries.Second, in order to get more clues, you might want to turn on displayerror and errorreporting in PHP.ini so that you can see the error messages displayed on the screen.Code: errorreporting(EALL);Code: iniset('displayerrors', 1);When you change the PHP.ini, you might need to restart your web server so that the modified PHP.ini is loaded.The error message on the screen should tell you what exactly might be the problem.Hope this helps.Warm Regards,/kksou.