DirectPHP plugin

download button
faq button

This plugin allows direct embedding of PHP commands right inside Joomla content page for dynamic contents.

Available for all Joomla versions: Joomla 1.0.x, native 1.5.x, 1.6.x, 1.7.x,2.5.x, 3.0.x and and 4.x!

Note: If you want to use this content plugin inside a Custom HTML Modules, please refer to this article: How to Run Joomla Content Plugins in Custom HTML Modules.


Key Features

  • Include PHP commands right inside your Jommla content page using the standard php construct:
  • <?php php_commands... ?>
  • Freely intermix static contents with php commands:
  • Now is: <?php echo date('Y-m-d H:i:s');?>
  • Leverage on all your PHP libraries right inside the content page:
  • <?php 
    require_once('fullpath/your_lib.php');
    your_php_func();
    ?>
  • 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.

Latest Version

v4.02 (for Joomla 4 and above)
Released Apr 15, 2022

Added support for Joomla 4!
Special thanks to Ruediger for his unremitting effort to locate me over a year and digging me out of hibernation to work on this! Ruediger is one of the core team members for the UNESCO Astronomy and World Heritage Webportal.

v3.01 (for Joomla 3 and above)
Released Sep 26, 2016

Added support for latest version of Joomla and PHP 7!

v3.0 (for Joomla 3.0)
Released March 21, 2013

Native version of DirectPHP for Joomla 3.0!

Don't forget to set the Filter Type to "No Filtering" so that you can enter PHP codes in a Joomla 3.0 article using the default WYSIWYG editor. Details here.

Background

I've recently redesigned this website using Joomla. As you can see, there are more than 450 PHP-GTK sample codes. It's just too much a hassle to include each sample code into every article. Isn't it nice if I could do a simple

echo "<pre>".htmlentities('filename.php')."</pre>";

to automatically include the respective sample code?

I've tried two other plugins: Jumi and RunPHP .

  • Jumi allows you to call or include another .php file. However, it doesn't allow you to add php commands right inside the content. What this means is that if you want to display a sample code, say example1.php, you need to create an intermediate .php file. In that intermediate php file, you then load and display the sample code with echo "<pre>".htmlentities('filename.php')."</pre>". These intermediate files accumulate very fast and is becoming a bit cumbersome.
  • RunPHP allows you to embed php commands right inside the content page. However, using it is a bit troublesome. You need to use, for example, JCE Editor with Show HTML view. You cannot use the default TinyMCE WYSIWYG Editor.

So I decided to develop my own plugin, and the result is this plugin DirectPHP.

How to install (Joomla 1.0.x)

  1. Download the plugin and unzip it into a folder.
  2. From the Installers menu, select mambots. In the field "Install directory", enter the folder location (where you unzipped the file) and click Install.
  3. From the Mambots menu, select Site Mambots.
  4. Make sure the plugin "DirectPHP" is published. If you see a cross in the Published column, just click on it. It will turn into a green tick.
  5. To try if it works, go to Content Manager, and copy the following text into any static content page:
  6. Current date and time is: <?php echo date('Y-m-d H:i:s');?>
  7. Now load that content page. You should see the current date and time displayed.

To customize the block list (Joomla 1.0.x)

  • From the Mambots menu, select Site Mambots and then click on DirectPHP.
  • On the right-hand side, you will see the Plugin Parameters "PHP commands to block".
  • Edit this list and click Save.

How to install (Joomla 1.5.x)

  1. Download the plugin and unzip it into a folder.
  2. From the Extensions menu, select Install/Uninstall. In the field "Install directory", enter the folder location (where you unzipped the file) and click Install.
  3. From the Extensions menu, select Plugin Manager.
  4. Enable the plugin (DirectPHP) - make sure there is a green tick in the Enabled column.
  5. To try if it works, go to "Content - Article Manager", and copy the following text into any static content page:
  6. Current date and time is: <?php echo date('Y-m-d H:i:s');?>
  7. Very Important: If you're using Joomla 1.5.8 and above, please refer to the article:
    How to enter HTML tags, javascript and PHP codes in Joomla 1.5.8?. Otherwise you might find that all your HTML tags, Javascript and PHP scripts will be removed the moment you click the Save or Apply button.
  8. Now load that content page. You should see the current date and time displayed.

To customize the block list (Joomla 1.5.x)

  • From the Extensions menu, select Plugin Manager, and click on DirectPHP.
  • On the right-hand side, you will see the Plugin Parameters "PHP commands to block".
  • Edit this list and click Save.

Examples

Here are some examples:

  1. You can display the current date and time with:
  2.  Now is: <?php echo date('l j D, Y H:i:s');?> 


  3. You can use for or foreach loop:
  4. <?php
    for ($i=0; $i<10; ++$i) {
        echo "$i: ".$i*$i,"<br>"; 
    } 
    ?>

  5. You can include your own PHP library and call the functions within that library:
  6. <?php
    require_once('/fullpath/your_php_library.php');
    display_image('image123.jpg');
    ?>
  7. You can sprinkle as many PHP statements you want within your content page. Note that these PHP statements will be processed in sequential order, and it respects all scoping of variables. So if you have set a variable earlier, you can use it in your PHP statements later.
  8. <?php global $a;
    $a = 10;?>
    This is a test. variable $a = <?php echo $a;?>
    
    <?php
    function f1() {
        global $a;
        return $a*2;
    }
    $b = f1($a);
    ?>
    
    You can access variable $a from within the function with global.
    variable $b = <?php echo $b;?>
    
  9. You can add any HTML statements through PHP:
  10. <?php
    echo "<table border=4$gt;";
    echo "<tr><td>a11</td><td>a12</td></tr>";
    echo "<tr><td>a11</td><td>a12</td></tr>";
    echo "</table>";
    ?>
  11. You can easily serve different contents for registered and non-registered members:
  12. For Joomla 1.0:

    <?php
    global $my;
    if ($my->id==0) {
        // non-registered members
        print "Please register or login.";
    } else {
        // registered members
        print "Contents for registered members.";
    }
    ?>

    For Joomla 1.5:

    <?php
    $user =& JFactory::getUser();
    if ($user->id==0) {
        // non-registered members
        print "Please register or login.";
    } else {
        // registered members
        print "Contents for registered members.";
    }
    ?>

Important Note: Blocking of PHP commands

By default, I've blocked some of the potentially "risky" commands, e.g. system, fopen, unlink, rmdir, etc.

You can view the entire list of PHP commands that are blocked in the plugin's property page. In there, you can also add, edit or delete this list of commands to suit your needs.

If you need to use any of these commands (e.g. mkdir) from within the content page, put them in one of the library files on your server, do a include() and then call that function. This is a much safer method.

If you insist, you may choose to turn off the blocking in the property page. However, I would strongly advise that you do so only if you're the only one maintaining your Joomla site. If you're opening up the adding and editing of content pages to the public, DO NOT turn off the blocking. It's too dangerous.

Disclaimer

DirectPHP is a simple, yet flexible and powerful plugin. I'm using it on this website. I'm sharing with you here because I think it will be very useful to some of you.

Your use of this plugin is at your own risk. kksou.com makes no warranties or representations, express or implied, as to the functionality or usefulness of this plugin. kksou.com disclaims all warranties, express or implied, including without limitation warranties of merchantability and fitness for a particular purpose. kksou.com disclaims liability for any direct, indirect, incidental, consequential, special, exemplary, punitive or other damages, or lost profits, that may result, directly or indirectly, from your use of this plugin, including without limitation any damage to computer systems, hardware or software, loss of data, or any other performance failures, or any errors, bugs, viruses or other defects that result from or are associated with use of this plugin.

Download

Note: To upgrade to the newer version, simply uninstall the old version and install the new version of the plugin.

Version History

  1. Version 1.00: released March 24, 2008.
  2. Version 1.01: released March 27, 2008.
  3. In TinyMCE Editor, when you press Enter, internally it's stored as a <p>. If you press shift-Enter, internally it's stored as <br>. In v1.00, if the user presses Enter after "<?php", the php script will not be captured. I only preg_matched for <br>. Overlooked the case for <p>. Bug has been fixed.

  4. Version 1.02: released April 6, 2008.
  5. In some of the editors, tabs is internally stored as &160;. If you're using tabs for code indentation, please download this update.

  6. Version 1.03: released May 12, 2008.
  7. 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.

  8. Version 1.04: released June 21, 2008.
  9. Now supports both PHP5 and PHP4.

  10. Version 1.05: October 11, 2008
  11. Thanks to Salvatore 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.

  12. Version 1.56: April 8, 2009
  13. Added one more parameter "Using No Editor". If you're not using any editor when editing content articles, select 'yes' for this parameter. This will allow you to freely use any HTML tags (such as <br /> or <p>).

  14. v1.6 (for Joomla 1.6)
    Released Feb 21, 2011
  15. Native version of DirectPHP for Joomla 1.6!

    Don't forget to set the Filter Type to "No Filtering" so that you can enter PHP codes in a Joomla 1.6 articles. Details here.

  16. v1.7 (for Joomla 1.7)
    Released October 10, 2011
  17. Native version of DirectPHP for Joomla 1.7!

    Don't forget to set the Filter Type to "No Filtering" so that you can enter PHP codes in a Joomla 1.7 article using the default WYSIWYG editor. Details here (works for both Joomla 1.6 and 1.7).

  18. v2.5 (for Joomla 2.5)
    Released January 25, 2012
  19. Native version of DirectPHP for Joomla 2.5!

    Don't forget to set the Filter Type to "No Filtering" so that you can enter PHP codes in a Joomla 2.5 article using the default WYSIWYG editor. Details here.

Comments   

+3 # Clotec 2012-01-23 16:05
i have installed this on my web site, but not work :sad:
Reply | Reply with quote | Quote
+7 # kksou 2012-01-23 19:45
Please give more details e.g.
1) what have you tried?
2) what are the tags that you are using? 3) what are the error messages that you see on the screen?
4) Can you try just a simple PHP statement such as echo "test123".
Does this work? Did you see the string "test123" on the screen?

Regards,
/kksou
Reply | Reply with quote | Quote
+2 # Clotec 2012-01-24 01:23
Hello,
thanks for answer. I have tried to add directly in article one complete file php that is a part of script but not work.
Reply | Reply with quote | Quote
+3 # kksou 2012-01-24 04:13
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
Reply | Reply with quote | Quote
+2 # Creo 2012-01-26 06:05
Hello,
Is it works on Joomla 2.5? :-|
Reply | Reply with quote | Quote
+6 # kksou 2012-01-26 08:30
Hi,

Have just released DirectPHP for Joomla 2.5!

Regards,
/kksou
Reply | Reply with quote | Quote
+3 # Creo 2012-01-26 09:03
Thanks a lot! :-)
Reply | Reply with quote | Quote
+4 # rve 2012-01-28 01:51
everything is ok when I write this on the same line "". As soon as I try to write:

it does not work :-( why?
Reply | Reply with quote | Quote
-1 # kksou 2012-02-02 17:10
Hi,

Your code didn't appear.

Would you like to email the code to me?

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # sqrl 2012-02-04 12:23
Hey,

I've got j 2.5 and I've gone through all steps and installed plugin.

However each time i write article content with tinyMCE like:

Now is:

it keeps changing it to:

Now is:

 

Any hints? I turned the filtering off :-|
Reply | Reply with quote | Quote
+1 # sqrl 2012-02-05 01:47
I quit using tinyMCE and using instead default one in joomla 2.5 - seem to work now perfectly ;)

Quoting sqrl:
Hey,

I've got j 2.5 and I've gone through all steps and installed plugin.

However each time i write article content with tinyMCE like:

Now is:

it keeps changing it to:

Now is:

 

Any hints? I turned the filtering off :-|
Reply | Reply with quote | Quote
+1 # Timmy123 2012-02-04 16:08
EXCELLENT PLUG IN!! I use it with my clickable map and it works a treat. Didn't have to change anything.
Reply | Reply with quote | Quote
+2 # beji14 2012-02-15 04:48
I install it on my local machine for joomla 1.7 but its not showing in "Module Manager: Modules" section. Aay reason behing it?
Reply | Reply with quote | Quote
0 # kksou 2012-02-15 05:06
Hi,

As the name says, this is a plugin.

So you will see it in the Plugin Manager and not Module Manager.

Regards,
/kksou

p.s. as this is a plugin, it's for use within an article. You can create a new article and test running some PHP commands from within the article.
Reply | Reply with quote | Quote
-2 # Irina 2012-02-15 05:40
What is this?

Parse error: syntax error, unexpected $end, expecting ',' or ';' in Z:\home\localhost\www\comfy-yard\plugins\content\D irectPHP\DirectPHP.php(57) : eval()'d code on line 1
Reply | Reply with quote | Quote
-2 # kksou 2012-02-15 05:46
Hi,

DirectPHP process PHP statements using the standard PHP's eval() function.

The error messages simply means there's some error in your code.

It's every difficult to debug based on the error message returned from the eval() statement. Would suggest you copy and paste your codes into a plain .php file and try running that .php file. You will get more meaningful error message that tells you where and what the error is.

Regards,
/kksou
Reply | Reply with quote | Quote
-5 # gm 2012-02-24 09:55
Hi, thanks for the great work! I would like some advice please. Is using this plugin and inputting php directly into the article unsafe in anyway? What's the difference between this method, and inputting the php into a module and loading its position from the article?
Thanks again.
Reply | Reply with quote | Quote
+2 # kksou 2012-02-27 15:10
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. e.g. 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
Reply | Reply with quote | Quote
-1 # TinaM 2012-02-28 10:57
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?
Reply | Reply with quote | Quote
+1 # TinaM 2012-02-28 11:01
My php tags in the 3rd paragraph and my short php echo statement in the fourth paragraph were stripped from my post.

I was explaining that I used php tags in the long script, and tried a simple one sentence echo statement to see if the long script was the problem. Neither worked. I would understand if the longer script didn't work and the shorter one did, but that's not the case. Many thanks.
Reply | Reply with quote | Quote
0 # kksou 2012-02-28 15:18
Hi,

When using the default Joomla editor, please DO NOT use the HTML mode. Use the wysiwyg mode.

Please try just one line:
echo 'test123';
first and see if works.

DirectPHP can work with multiple lines - it's just that debugging is very difficult.

In any case, please try the above one more time and let me know if it works.

Regards,
/kksou
Reply | Reply with quote | Quote
0 # TinaM 2012-02-29 09:10
Hi. 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?
Reply | Reply with quote | Quote
+3 # Chris M 2012-03-14 05:40
I have Joomla 2.5.2, PHP Version 5.2.9
and when I load the public page I get the following error message: Parse error syntax error unexpected '.' in /public_html/n/plugins/content/DirectPHP/DirectPHP .php(58): eval()'d code on line 1

Thank you for your time,
Chris
Reply | Reply with quote | Quote
+3 # kksou 2012-03-14 19:34
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
Reply | Reply with quote | Quote
+3 # vvvvv 2012-03-29 11:28
Hi

script:


Work in standard PHP,
in DirectPHP have error
"Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /plugins/content/DirectPHP/DirectPHP.php(57) : eval()'d code on line 1"
Reply | Reply with quote | Quote
+3 # vvvvv 2012-03-29 11:29
this is the script

if ($_GET["chronoform"]=="WybierzDate")
{
echo "{chronoforms}Lista dni{/chronoforms}";
} else
{
echo "{chronoforms}WybeierzDate{/chronoforms}";
}
Reply | Reply with quote | Quote
+1 # kksou 2012-04-12 07:59
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
Reply | Reply with quote | Quote
0 # HaraldEngels 2012-04-10 03:37
Stopped to work in Joomla 2.5.4:
"Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /plugins/content/DirectPHP/DirectPHP.php(59) : eval()'d code on line 1"
Reply | Reply with quote | Quote
+2 # kksou 2012-04-10 05:08
Hi,

As the error message says, the error message is in the PHP code that you're trying to run.

Please refer to the following post for debugging tips: http://www.kksou.com/php-gtk2/index.php?option=com_fireboard&Itemid=67&func=view&id=4601&catid=16#4617

Regards,
/kksou
Reply | Reply with quote | Quote
0 # JugglingReferee 2012-04-11 14:41
I am using Joomla 2.5.4. I've been looking for something like this for quite some time!

I installed the plug-in, enabled it, changed the SU setting to "No Filtering", but the expected results do not show.

The PHP code in my article is "

When I investigate why the expected output did not show, it is because there are HTML comment tags around the PHP code.

I did check to make sure that "Prepare content" was "Yes", as suggested on the Joomla forums.

Any ideas? Thanks...
Reply | Reply with quote | Quote
+1 # JugglingReferee 2012-04-11 14:44
The PHP code in my article is:

less-than-character NOSPACE question-mark NOSPACE php SPACE echo SPACE "Hi."; SPACE question-mark NOSPACE greater-than-character
Reply | Reply with quote | Quote
0 # kksou 2012-04-12 07:52
Hi,

1) Did you see anything on the screen? Did you see the code?

2) When you enter the PHP codes in the article using the default Joomla editor, please make sure that you enter in the WYSIWYG mode. DO NOT use the HTML mode.

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # JugglingReferee 2012-04-12 09:17
Update: I was able to get DirectPHP to function properly by switching to the CodeMirror Editor within Joomla 2.5.4. (I was previously using TinyMCE.)

My next task is to get PHP code working that will output text as an image. My first attempt outputted the raw image data rather than the browser rendering an actual image.
Reply | Reply with quote | Quote
-3 # JugglingReferee 2012-04-17 12:28
Success. But I could not get this to work via DirectPHP. I was able to do this though:A
Reply | Reply with quote | Quote
-1 # Peter Winkels 2012-04-26 08:31
Hello,

I'm interested in using phpDirect, but I want to restrict the possibility of including php-code only for Super-User. It'S possible? In which way?

Greetings * Peter Winkels
Reply | Reply with quote | Quote
+2 # kksou 2012-04-26 08:47
Hi Peter,

Joomla does not have any access control for plugins and modules. So there's no way you can restrict the running of a plugin by users.

But if you know a bit of PHP and know how to retrieve the user id from within the Joomla framework, you can modify the source code of DirectPHP to achieve this.

Regards,
/kksou
Reply | Reply with quote | Quote
0 # Fabio Codebue 2012-04-26 10:21
a sample to use with virtuemart ?
I need to access to some virtuemart table directly....
Reply | Reply with quote | Quote
+2 # wdb 2012-05-21 00:41
DirectPHP basically works on my 2.5.4 site (JCE Editor), but HTML tags are stripped:
echo 'abc'
comes out as 'abc' (no p-tags ...)
Any idea? Thank you!
Reply | Reply with quote | Quote
+2 # kksou 2012-05-21 07:26
Hi,

Have you tried the tips as outlined in the article "How to enter HTML tags, javascript and PHP codes in Joomla 2.5?": http://www.kksou.com/php-gtk2/Joomla-Tips-Techniques/How-to-enter-HTML-tags-javascript-and-PHP-codes-in-Joomla-2.5.php

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # wdb 2012-05-21 07:31
I followed the instructions, yes, filter off etc. Is there a specific tip you refer to? I am now using Sourcerer, which basically works, no stripping, but is a bit less convenient ...
Reply | Reply with quote | Quote
+1 # wdb 2012-05-21 01:17
Details: tags like are not stripped. And I found that is not simply stripped, but adds a newline in the source code.
Reply | Reply with quote | Quote
-3 # wdb 2012-05-21 01:18
tags like "tr" are not stripped
Reply | Reply with quote | Quote
0 # kay 2012-06-13 12:33
Can it be used to add a donate functionality that connect to my database and submits the value inputed? If yes, is there any tip here.
Reply | Reply with quote | Quote
-3 # john246 2012-06-13 13:08
Thanks for this plugin. It works great. Using Joomla! 2.5.0 Stable.

For what its worth:

1. I disable all the editors.
2. I use a php editor like notepad++ to get my php code working OUTSIDE of joomla. Once I know my code is really working, I paste it into a Joomla article.

Plug in works like a champ!
Reply | Reply with quote | Quote
-2 # WebsiteD2 2012-06-14 08:37
Works on Joomla 2.5! Questions,does this plugin support foreach array?

$business_name=$_POST['bus_name'];
....and so fort
$statement=$_POST['value3'];

$data =array();
foreach($_POST as $statement =>$value){
if (empty($value)) continue;
$data[$statement] =$value;
}
//insert to database
$sql="INSERT INTO statement (Bus_name, Name, Email, Phone, Total_Volume, Transaction, Statement_Fees )
VALUES ('$business_name','$name', '$email', '$phone','$total_volume','$transaction','$value')";

I notice all fields are inserted to the DB except Statement Fees it save as 0 even there's a value entered on the text field.

Can you help, Thanks! WebsiteD2
Reply | Reply with quote | Quote
+3 # kksou 2012-06-15 07:39
It should.

Why don't you put some debugging statement and see what's the value.

$data =array();
print_r($_POST);
foreach($_POST as $statement =>$value){
echo "statement($statement) value($value)";
if (empty($value)) continue;
$data[$statemen t] =$value;
}

Regards,
/kksou
Reply | Reply with quote | Quote
+3 # Mony 2012-06-28 09:59
Good
Reply | Reply with quote | Quote
0 # Daniel Etnatribe 2012-07-03 06:48
I'm trying to insert php code between tags referring to other plugin (ex. {gallery} ...my php code .. {/gallery} ). I am using joomla 2.5.. when I used to use 1.5 the example above worked fine with directphp but now I just cannot get it to work!
Reply | Reply with quote | Quote
+2 # kksou 2012-07-03 07:03
Hi,

1) What did you see on the screen? Are there any error messages?

2) Also, please go to the Plugin Manager and make sure that the order of DirectPHP comes before that of your plugin. e.g. if the order of your plugin is 10, make sure the order of DirectPHP is 8 or 9, or even 1. What this does is to make sure that DirectPHP is processed before your plugin.

Please give (2) a try and let me know if it works.

Regards,
/kksou
Reply | Reply with quote | Quote
-2 # Daniel Etnatribe 2012-07-04 01:02
Thanks :) that was the problem... the order of the plugins!
Reply | Reply with quote | Quote
0 # kaysar 2012-07-04 06:26
Hi it work normal php without ant problem. But if i want to use a form and want to see the submite result on the same article page then what should i write in action=""?
Thanks in advance
Reply | Reply with quote | Quote
-1 # JugglingReferee 2012-07-11 21:46
I'm trying to create a "Forgot Password page".

I have it working without a problem where the form's action goes to a PHP file that is not apart of a Joomla 2.5 article.

I'd like to make the PHP code inside an article, so that I retain all the same look.

In my form, I ask for the user's e-mail address. When submitted to a page with the (working) code that has the code inside a Joomla article, all I receive is this:


Parse error: syntax error, unexpected T_STRING in {directory_clipped_for_privacy}/plugins/content/Di rectPHP/DirectPHP.php(58) : eval()'d code on line 119

Any ideas?
Reply | Reply with quote | Quote
0 # JugglingReferee 2012-07-11 21:49
Quoting JugglingReferee:
I'm trying to create a "Forgot Password page".

I have it working without a problem where the form's action goes to a PHP file that is not apart of a Joomla 2.5 article.

I'd like to make the PHP code inside an article, so that I retain all the same look.

In my form, I ask for the user's e-mail address. When submitted to a page with the (working) code that has the code inside a Joomla article, all I receive is this:


Parse error: syntax error, unexpected T_STRING in {directory_clipped_for_privacy}/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 119

Any ideas?


Line 119 in my code is a } and it is in the proper position.

Line 58 in DirectPHP.php is... I don't know! haha
Reply | Reply with quote | Quote
-3 # kksou 2012-07-23 08:36
Hi,

Please refer to the following article:
Using DirectPHP - intermixing PHP with HTML commands
http://www.kksou.com/php-gtk2/Joomla/Using-DirectPHP-intermixing-PHP-with-HTML-commands.php

Please make sure that you do not intermix PHP with HTML commands.

Regards,
/kksou
Reply | Reply with quote | Quote
0 # JugglingReferee 2012-07-12 07:06
I used the above require-once method and it works well enough.

I'd like to have had all the code in my article, but that wouldn't work, so this is a good enough compromise. It gets the job done and now my app is almost done!
Reply | Reply with quote | Quote
0 # Ahmedk 2012-07-20 14:07
Hi
thank you for your plugin :)

I'm having a problem the plugin wont run a command which is not in the block list or maybe its the same as a blocked command its curl_init and curl_exec and curl_setopt i searched in the blocked list but cant find it any help?

thank you.
Reply | Reply with quote | Quote
+1 # kksou 2012-07-23 04:13
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 just


Load the file in your broswer.

Then check if your PHP has the curl library installed.

Regards,
/kksou
Reply | Reply with quote | Quote
-2 # jonathan rick 2012-07-21 18:32
i already installed the plug in. im wondering why this line break tags and paragraph tags are being ignored on my article.. can someone can explain this? thanks..
Reply | Reply with quote | Quote
0 # kksou 2012-07-23 07:52
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 "using_no_editor" to "Yes". The default is "No" which strips away all [br] and [p].

Regards,
/kksou
Reply | Reply with quote | Quote
+5 # Ahmedk 2012-07-23 04:23
Quoting 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 just


Load the file in your broswer.

Then check if your PHP has the curl library installed.

Regards,
/kksou


yes 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.
Reply | Reply with quote | Quote
-2 # kksou 2012-07-23 07:34
Hi,

In that case, please turn on error_display in your php.ini.

Then put all your PHP scripts into a .php file somewhere on your server, and then using DirectPHP add:


Please let me know what's the error messages that you see on the screen.

Regards,
/kksou
Reply | Reply with quote | Quote
-2 # Steve Harman 2012-07-26 07:05
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
Reply | Reply with quote | Quote
+2 # Tes 2012-08-30 14:35
First, you've creates a very useful plug-in. I installed and it works however I am using it to pull data from the database and instead of the data itself I am getting Resource #122 (#121 etc.). Wats my boo boo?
Reply | Reply with quote | Quote
+1 # kksou 2012-08-31 08:13
Hi,

Can you elaborate a bit more what do you mean by "instead of the data itself"? And what's that Resource #122 (#121 etc.)? Can you please show the complete error message that you see on the screen?

Regards,
/kksou
Reply | Reply with quote | Quote
-1 # Tes 2012-08-30 14:37
Quoting Tes:
First, you've creates a very useful plug-in. I installed and it works however I am using it to pull data from the database and instead of the data itself I am getting Resource #122 (#121 etc.). Wats my boo boo?


Also, I'm running Joomla 2.5, database is thru PHPMyAdmin
Reply | Reply with quote | Quote
-2 # Hausmaster 2012-08-31 07:48
It doesn't work for me with Joomla 2.5.6. :(
I set all settings the way you explained it.

I use JCE and TinyMCE.
In JCE WYCIWYG Mode Joomla displays just the pure php code, in HTML Mode nothing appears.

IN MCE the PHP Part looks like this:

I use following line:

Could you write me an E-Mail, I could give you acces to see it. Thats strange!
Reply | Reply with quote | Quote
+2 # Hausmaster 2012-08-31 07:49
Okay, it looks like this: < ! - - .... - - > (comment function deleted it)
Reply | Reply with quote | Quote
0 # JugglingReferee 2012-09-07 12:30
Can I use this syntax:



lots of html code
Reply | Reply with quote | Quote
-5 # JugglingReferee 2012-09-07 12:32
Can I use this syntax:

open PHP tag

some code in an if else statement

curly brace to open the else clause

close the php tag

lots of html code





open the php tag

closing curly brace for the else clause

close the php tag again.
Reply | Reply with quote | Quote
-2 # alainvtr1 2012-09-13 14:21
this code :


render this :

test

'; ?>

what's wrong ?
Joomla 1.5.26
no editor
Reply | Reply with quote | Quote
-4 # kksou 2012-09-17 08:47
Hi,

Cannot see your code.

Please email me the code or send the code via the feedback form.

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # alainvtr1 2012-09-17 14:13
hi,
another try :

echo date('l j D, Y H:i:s');
echo 'test';
Reply | Reply with quote | Quote
+1 # alainvtr1 2012-09-17 14:15
i add blanks ...

< ? php
echo date('l j D, Y H:i:s');
echo '< p >test< / p >';
? >
Reply | Reply with quote | Quote
+1 # kksou 2012-09-17 23:06
1) And what did you see on the screen?

2) If you just put the first line
echo date('l j D, Y H:i:s');
what did you see on the screen?

Regards,
/kksou
Reply | Reply with quote | Quote
+3 # alainvtr1 2012-09-18 15:02
1) i see what is say on the post 2012-09-13

2) with only date, nothing appear
Reply | Reply with quote | Quote
+1 # alainvtr1 2012-09-18 15:10
oups ...
in fact, it work well

i use the preview ... in the preview, it doesn't work ...
Reply | Reply with quote | Quote
+4 # Fabian 2012-09-23 05:14
Hi

Wonderfull extension, I just have 1 question I keep getting a parse error eval() when i try to do the follow

$db =& JFactory::getDBO();
$query = "SELECT ....";
$result = $db->setQuery($query);
but it works fine when i omit the $result and use an echo.

How can i save that value into a variable?

Thanks
Reply | Reply with quote | Quote
-1 # chevron08 2012-09-24 02:12
hi,
i have some problems, i have make a module with this included php:

In the Module is all fine, but if i insert this php string in a content site i got an error:
Warning: require_once(hotel_preise/Prima_Life_Makadi_Resort .php) [function.require-once]: failed to open stream: No such file or directory in

Can you help me, please.
regards
Reply | Reply with quote | Quote
-1 # kksou 2012-09-24 05:07
Hi,

You have to use the fullpath instead of relative path.

Regards,
/kksou
Reply | Reply with quote | Quote
+2 # chevron08 2012-09-27 12:16
Quoting kksou:
Hi,

You have to use the fullpath instead of relative path.

Regards,
/kksou

if iuse the fullpath i got a second error that in my server config is not allowed open urls.

Strange ist, i got this error after i click on save. but the content was saved, i can the it in the frontend.

all settings are changed to "no filtering".
i use the JCE Editor and joomla 2.5.7

regards
Reply | Reply with quote | Quote
+7 # Fl4mby 2012-10-03 14:57
Hi,

I have to display some custom serverside code for each contact on my Joomla 2.5 install. Do you think DirectPHP could do that?

I've tried without success, and I was wondering how hard you think your code was to tweak to achieve just that?

Thanks !
Reply | Reply with quote | Quote
-3 # Fl4mby 2012-10-03 15:16
Ok, I've done it through a custom HTML module ;)

Thanks !
Reply | Reply with quote | Quote
+3 # Duragoo 2012-10-05 18:28
Im using it on joomla 2.5.7 and as until now it works great. Can use PHP directly in php, can include code from files and whats more i mix PHP, JAVA, HTML and CSS and it still work perfectly :D This extension is awesome ! good good good
Reply | Reply with quote | Quote
-3 # Duragoo 2012-10-05 18:46
Try this for test in your article.
Its php+java+html
Reply | Reply with quote | Quote
+5 # thanawatkim 2012-10-10 23:04
Thanks so much for your work.
I use directPHP for long time. It is excellent. I only use normal code 1-2 lines. Please kindly suggest (which page to learn) for deep php. (Form, database)
Website http://krabihotelworld.com integrate travel affiliate program
environment
Joomla 2.5/editor Ace/404sef/

Thanks again
Reply | Reply with quote | Quote
+2 # Piyush 2012-10-13 22:23
I cant see the php "date" code working in my article. i installed and enabled the plugin as described, but still cannot get the output.. what should i do?
Reply | Reply with quote | Quote
+4 # kksou 2012-10-14 20:53
Hi,

1) What did you see on the screen then? Did you see the original PHP code? Or you see nothing.

2) Are you using the default Joomla editor? If yes, please make sure you do not use the HTML mode. Please use the defualt WYSIWYG (What you see is what you get) mode to enter the code.

Regards,
/kksou
Reply | Reply with quote | Quote
-6 # mokibd 2012-10-14 13:20
Not Work & show the error on screen..Why?

Warning: Invalid argument supplied for foreach() in C:\xampp\htdocs\advancejoomla\plugins\content\Dire ctPHP.php(54) : eval()'d code on line 9
Reply | Reply with quote | Quote
-4 # kksou 2012-10-14 22:26
Hi,

May I know what's the code that you've used.

Also, please refer to the following article: How to debug PHP codes in DirectPHP

Please follow the instructions there. In (4) and (5), if you see any error or warning messages, please copy and paste it here so that I have more clues as to what might be the problem.

Regards,
/kksou
Reply | Reply with quote | Quote
-2 # panca 2012-11-14 03:54
Can u sample me how to use php syntax : require_once ??
fullpath can u explain where is start fullpath???
Reply | Reply with quote | Quote
0 # kksou 2012-11-14 18:50
Hi,

Please google for "full path" and you can see many articles describing this.

Here's the one from wiki: wiki: Path (computing)

Regards,
/kksou
Reply | Reply with quote | Quote
-2 # JP 2012-12-06 09:58
This worked great with all my Joomla 1.0.x sites. Though I was looking for something different in order to avoid editing thousands of content articles. I am looking for a plugin where to insert any php code and be executed on every single page.
Reply | Reply with quote | Quote
-2 # eNkrypt 2012-12-10 01:25
When will you add support for Joomla 3?
Reply | Reply with quote | Quote
+1 # dicko 2013-01-04 10:56
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
$php_start = "" or "?>";
I can now use the plugin with a more sophisticated editor than tinymce.
I would like anyones comment on this.
Reply | Reply with quote | Quote
-1 # dicko 2013-01-04 11:01
Quoting dicko:
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
$php_start = "" 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)
Reply | Reply with quote | Quote
-3 # dicko 2013-01-05 15:17
Quoting dicko:
Quoting dicko:
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
$php_start = "" 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)


$php_start = "" or "?>" should be
$php_start = "comment+startPHPcode" or "startphpcode"
$php_start = "endcomment+endphp" or "endphp" (I hope you know what I mean) :)
Reply | Reply with quote | Quote
0 # Solir 2013-01-18 04:42
Thanks for this great plugin. It works perfectly :D :D :D
Reply | Reply with quote | Quote
+4 # fabfab 2013-01-31 02:42
thanks for the plugin, using joomla 2.5 and joomlaCK editor. I installed the plug in but nothing happens... my php codes inserted in articles is commented out systematically.
I have no filtering set up.
any insight? :sigh:
Reply | Reply with quote | Quote
0 # kksou 2013-01-31 05:13
Hi,

Just a few days ago, another user encounters similar thing. Turns out that there's another plugin that automatically comments out any scripts - both PHP and javascript.

Please check if there's any such plugin in your system.

To be sure, I would recommend that you install a fresh copy of Joomla somewhere else on your site, and then install just the DirectPHP plugin. This will allow you to see if the script works on your system at all.

Regards,
/kksou
Reply | Reply with quote | Quote
-8 # KennyJ 2013-02-03 15:34
Hello, I am not sure if this is what I need to buy so I need some guidance. I am looking to take complex pre-existing php/mysql scripts(programs) and place them into my joomla site. Does this software achieve this?
Thanks
Reply | Reply with quote | Quote
+3 # kksou 2013-02-03 17:18
Hi,

You might want to take a look at the article "How to debug PHP codes in DirectPHP" - Can DiectPHP runs all PHP codes?

The key thing is, DirectPHP is a Joomla plugin. As the name suggests, a plugin is run within a Joomla article.

What this means is that NOT ALL PHP scripts can be run within the Joomla framework.

For your case, would suggest you write a plugin, module or component in which your PHP codes will be run "native" within Joomla, instead of an additional layer.

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # Doug Crosby 2013-02-06 02:07
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?
Reply | Reply with quote | Quote
-1 # Markf 2013-02-11 07:46
Hi

Will this run on Joomla 3.0 and if not are you planning a new release?

Many thanks

Mark
Reply | Reply with quote | Quote
0 # kksou 2013-02-11 09:10
Hi Mark,

I made it a point to support all Joomal versions. That's why you see there are versions all the way back to Joomla 1.0.

Problem is I've many projects at hand. Haven't got the time to play with Joomla 3.0 yet.

Will try to do it by end of this month.

Will send you a copy once it's ready, ok?

Warm Regards,
/kksou
Reply | Reply with quote | Quote
-1 # eric12578 2013-02-12 21:41
it's very well in joomla 3.03
Reply | Reply with quote | Quote
+1 # Markf 2013-02-12 22:02
Many thanks Kksou, that would be really appreciated and thanks eric for info
Reply | Reply with quote | Quote
0 # rdehavleyn 2013-02-13 13:15
Hi, thanks for the great work. This looks really interesting. Do you have a copy for Joomla 3.0.x?
Reply | Reply with quote | Quote
+2 # sus 2013-02-18 03:45
i am doing a mail function.but i got this error

parse error: syntax error, unexpected T_STRING in C:\xampp1.7.3\htdocs\susmita\nrss prtc\plugins\content\DirectPHP\DirectPHP.php(58) : eval()'d code on line 8

can anyone tell me where i did d mistake;
Reply | Reply with quote | Quote
+1 # kksou 2013-02-18 04:54
Hi,

Please refer to the article: How to debug PHP codes in DirectPHP

As DirectPHP uses the standard PHP eval() function, the error message you have given does not tell us anything.

You might want to list here what's PHP statement that you are trying to run. Otherwise it's very difficult for other people to help you without any further info.

Regards,
/kksou
Reply | Reply with quote | Quote
-1 # eric12578 2013-02-19 05:51
for joomla 3, it's work for simple code but with more complexe code, i am not sure. i prefer wait officiel plugin of directPHP
Reply | Reply with quote | Quote
0 # bidiweb 2013-02-19 07:19
Hi,
i installed the plugin. It work' fine.
Now i try to code my content-page with some tables. therefor i use the html editor from TinyMCE.
Al my "php-Code" will be blocked like this:
"
Reply | Reply with quote | Quote
0 # kksou 2013-02-19 18:03
Hi,

If you need to add tables in HTML code using PHP's echo statement, you might want to try other editors like JCE Editor that allows you to enter the HTML codes in source mode.

Please also make sure that you set the appropriate setitngs in Joomla such that the HTML codes are not automatically stripped away by default.

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # ZeroCool 2013-03-16 10:25
Love this plugin, works fantastic mine wasn't working untill I read through a few of these comments and disabled my tinyeditor (mce) like you did. Now the date command in php works like a charm.

Looking forward to the 3.0 version later on :)

Keep this up! :lol:
Reply | Reply with quote | Quote
-2 # kksou 2013-03-20 17:20
Hi ZeroCool,

Pleased to tell you that I've just released the 3.0 version!

Download here: DirectPHP v3.0

Regards,
/kksou
Reply | Reply with quote | Quote
+2 # kksou 2013-03-24 06:27
Hi ZeroCool,

Just to let you know that DirectPHP for Joomla 3.0 is now available.

You can download it here: DirectPHP v3.0

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # paul f 2013-03-25 11:39
back to coding after 1994 when I got a decent job - nothing has changed really - people take coding like religion - still all programs, frameworks and languages offer you a powerful tool to build a new brooklyn bridge - finally you realize you are washing the old one with your tooth brush!! hex basic fortran cobol pascal modula lisp c c++ - they are all the same s**t! peace brother peace ... and get a life where you move your ass instead of letting it grow ... :lol:
Reply | Reply with quote | Quote
+2 # Mohs 2013-03-26 14:57
HTML tag in a php comment line would stop execution of the php script:


By removing "br" in the comment line or by removing the comment (//), the problem is resolved!!
Reply | Reply with quote | Quote
+3 # yaletech 2013-05-02 03:09
I am trying to create a query which will get the Joomla username as the filter.

example of the code
Reply | Reply with quote | Quote
-1 # yaletech 2013-05-02 03:13
looks like the codes and the explanation after them were striped from my earlier posting. Sorry.

I want to embed a second php statement to call the current username to act as the filter in my sql WHERE statement in my query but the second php statement never got executed. Should I just use an intermediate php file and include it in the article or is there another way to code it directly in the article?
Reply | Reply with quote | Quote
-1 # kksou 2013-05-06 02:17
Hi,

Multiple lines of codes should work right inside the article.

e.g. you can try
[?php
echo 'test1';
echo 'test2';
echo 'test3';
?]

note: please replace square brackets with angle brackets above

You should 'test1', 'test2' and 'test3' on the screen.

Regards,
/kksou
Reply | Reply with quote | Quote
-3 # t2m 2013-05-02 11:43
I'm glad this plugin exists. I've used it successfully on my site but today I come to an issue. I can't seem to use:

$user->

because it closes the
Reply | Reply with quote | Quote
+2 # t2m 2013-05-02 11:45
it closes the "< ? p h p" tag every time it sees a -> in the code.

Any ideas?
Reply | Reply with quote | Quote
-2 # kksou 2013-05-06 02:14
Hi,

That's really strange, because I'm using lots of -> on my site too.

Can you please do just a one liner and see if it works?
e.g. [?php $test = array('a'=>'test1'); echo $test->a; ?]
note: replace square brackets above with angle brackets.

Do you see 'test1' on the screen?

Regards,
/kksou
Reply | Reply with quote | Quote
0 # Gary Zabriskie 2013-05-08 08:18
Morning,
I have installed the directPHP in my Joomla 3 test site. And it works but I keep getting this message.

Notice: Undefined index: view in /var/www/html/joomla3/plugins/content/DirectPHP/Di rectPHP.php(58) : eval()'d code on line 1
Reply | Reply with quote | Quote
-1 # kksou 2013-05-08 08:29
Hi,

If you try just a one-liner: echo
[?php 'test123';?]

Think you will not get the error message.

This means that somewhere in your code produces this warning message.

Please refer to the article How to debug PHP codes in DirectPHP

Save your codes in a standalone .php file and debug from there. Once you've debug the code, you can then transfer the code back to your article.

Regards,
/kksou
Reply | Reply with quote | Quote
-1 # Gary Zabriskie 2013-05-08 08:56
Quoting Gary Zabriskie:
Morning,
I have installed the directPHP in my Joomla 3 test site. And it works but I keep getting this message.

Notice: Undefined index: view in /var/www/html/joomla3/plugins/content/DirectPHP/DirectPHP.php(58) : eval()'d code on line 1



Never Mind it was me ... my bad code.
Reply | Reply with quote | Quote
+3 # Arnold33 2013-05-12 13:51
hello
Your plugin is very good.
I have a big problem on my site against.
on my pages php code is displayed, I do not know why.

how can I remove the PHP code so that it does not appear in the front-end.
everyone sees the code

Please help me it's urgent.
Reply | Reply with quote | Quote
-4 # kksou 2013-05-12 15:36
Hi,

If the code displays, it usually means DirectPHP is not running.

Please check in the Plugins Manager that it's enabled.

Otherwise, please remove the code first and do the testing on some development machine or some remote article.

Regards,
/kksou
Reply | Reply with quote | Quote
+3 # Arnold33 2013-05-12 16:32
hi
thank you for your quick response.
the plugin is enabled, I have tested this code, and it works: get ('mypg', null) if ($ fg == 'n') echo ('
Kjære språk-entusiast!
Det er å morsomt Laere and fremmed språk man heard nybegynner eller er litt OVET. Forutsetningen selvfølgelig følelsen av er noe å få igjen for innsatsen.

') Else echo ('
Dear language enthusiast!
Whether you are a beginner or know a bit Already, learning a foreign language is fun, as long, of course, as you feel you are reaping the rewards of your efforts.

')>
Read more ...
Reply | Reply with quote | Quote
0 # Arnold33 2013-05-12 16:36
hi
thank you for your quick response.
the plugin is enabled, I have tested this code, and it works:
Reply | Reply with quote | Quote
-2 # Arnold33 2013-05-12 16:40
sorry my text was cut

hi
thank you for your quick response.
the plugin is enabled, I have tested this code, and it works: [php?
echo 'test1';
echo 'test2';
echo 'test3;
]
but I put my code, it does not work.
I do not understand because 1 week ago it worked well.
I made ??no changes
you have an idea.
J'utilse joomla 1.5.14
Reply | Reply with quote | Quote
0 # kksou 2013-05-12 18:23
Hi,

You said one week ago it worked well.

Now please try echo 'test123' again. Do you still see the code, or just 'test123'?

If you see the code, that means DirectPHP is not working. It might be conflicts with your other plugins or modules that you have just installed.

If you see 'test123', it means there's some error in the code. You may want to refer to the article: How to debug PHP codes in DirectPHP

Regards,
/kksou
Reply | Reply with quote | Quote
-1 # Arnold33 2013-05-13 07:56
hi

I have always the same problem
I have not installed module or plugin.
I just look in the joomla administration and save to make a comeback.

My code works well elsewhere.

when I do echo "test123" I do not see that test123
Reply | Reply with quote | Quote
0 # Arnold33 2013-05-13 10:43
hi it's me again

here is the code that I put in a module
get('myfg', null); $pg = $session->get('mypg', null); if ($fg == 'n') echo('

and in another module I put
'); else echo ('

last module is
'); ?>;

I have a session english and another Norwegian.

do you think that there is an error in the code

:sigh:
Reply | Reply with quote | Quote
-3 # kksou 2013-05-13 21:23
Hi,

Please refer to the article: How to debug PHP codes in DirectPHP

Please try to copy your code to a standalone .php file. Also turn on the display_errors in your php.ini file

You will then be able to see the actual error or warning messages.

Right now based on the information you've given here, it's very difficult to tell where might be the problem.

Regards,
/kksou
Reply | Reply with quote | Quote
-3 # JugglingReferee 2013-05-14 06:53
I can't seem to get to work.

Inside an article, I open the PHP tag and can run PHP code no problem.

But if I try to echo a br tag, the br doesn't show/advance a blank line.
Reply | Reply with quote | Quote
-2 # Arnold33 2013-05-14 13:20
HI
it's ok now

thanks you

good working
Reply | Reply with quote | Quote
-2 # Netsistence 2013-05-15 01:19
Hi, I tried installing DirectPHP on Joomla 3.1.1 but joomla shows up with error:
Failed to parse time string (jerror) at position 0 (j): The timezone could not be found in the database.

When will there be a 3.1.x version of DirectPHP?
Reply | Reply with quote | Quote
+2 # kksou 2013-05-15 01:59
Hi,

The current version of DirectPHP works with the latest version of Joomla. I'm using it on my site.

1) Which PHP version are you using?
2) At which point does the error message occurs - during installation? I've never seen such an error before during installation.

Please provide more details so that I have more clues as to where might be the problem.

Regards,
/kksou
Reply | Reply with quote | Quote
0 # Netsistence 2013-05-15 03:00
Thnx for responding so soon!

PHP version 5.3.3-7 + Squeeze3
Joomla 3.1.1 with dutch language package installed.
The site is hosted on Apache webserver using apache2handler
The exact error is:
DateTime::__construct(): Failed to parse time string (jerror) at position 0 (j): The timezone could not be found in the database.

I've downloaded version v3.0 of PHPDirect, but inside the file DirectPHP.php comment stops at v2.5 Jan 25, 2012.
Reply | Reply with quote | Quote
+2 # kksou 2013-05-15 06:17
Can you pleas confirm that the error is displayed during installation?

Or is the error the result of running DirectPHP with some of your PHP codes?

Regards,
/kksou
Reply | Reply with quote | Quote
-1 # Netsistence 2013-05-15 08:08
Sorry, forgot to answer that part of your question.
Yes, the error comes up while installing DirectPHP.
Reply | Reply with quote | Quote
-1 # kksou 2013-05-15 08:59
Hi,

That's really strange, because I just tried installing it on a fresh install of Joomla and it worked fine.

If you have some time, would you mind do the same - i.e. try set up a fresh install of Joomla and then install DirectPHP. See if you get the same error.

This will allow us to see if DirectPHP works on your server at all, or if it's conflicts with some plugins.

Regards,
/kksou
Reply | Reply with quote | Quote
-4 # Netsistence 2013-05-15 11:56
Hi,
I tried new installation on the same server
Get the same error.
On the same server I do have a joomla 2.5.8 site running DirectPHP realy fine.
Reply | Reply with quote | Quote
+2 # kksou 2013-05-15 21:04
Hi,

You mentioned that you're using PHP version 5.3.3-7 + Squeeze3

Could it be because of this?

Do you have any other system that you can try? Just to want eliminate the possible root cause one by one.

Alternatively, there are other PHP plugins on joomla.org. Maybe one of them will work with your host.

Regards,
/kksou
Reply | Reply with quote | Quote
0 # Netsistence 2013-05-16 01:02
Looking at joomla forum last night, found more issues on this error for Joomla 3.1. It likely is an error in this version.
I do not have an other server to do the test on different PHP versions.Thnx for your comment. Regards, Bert
Reply | Reply with quote | Quote
+2 # Netsistence 2013-05-16 09:50
As suggested by someone at the joomla forum I decided to reïnstall Joomla, using version 3.0.x. On that version DirectPHP is now succesfully installed.
Reply | Reply with quote | Quote
0 # Jose1974 2013-05-18 02:25
Fantastic job!!! And only 4Kb!!! Incredible, fantistic, no words, congratulations!!
Reply | Reply with quote | Quote
+2 # Amicus 2013-06-07 22:42
Great work.
Plugin works without problems for me.
But, I have question.

How can I disable plugin for some Joomla Articles?

I need to show some PHP code examples inside of the article, but my example PHP code gets executed by DirectPHP.
Reply | Reply with quote | Quote
0 # kksou 2013-06-08 00:15
Hi Amicus,

The plugin grep for [?php and ?]

So try the following:
[?php echo "["."?"."php";

...
your sample codes here
...

[?php echo "?"."]"; ?]

Note: change all square brackets above to angle brackets

Let me know if it works, ok?

Regards,
/kksou
Reply | Reply with quote | Quote
+3 # Amicus 2013-06-08 07:28
Thank you for your answer, but it doesn't work for me :sad:

I have tried every combination.
Problem is that if you echo PHP code, it gets executed.

But, I have found following solution:
If I put some character (.) behind
Reply | Reply with quote | Quote
-3 # Amicus 2013-06-08 07:30
I have used < instead [

But, I have found following solution:
If I put some character (.) behind [?php. but choose its color is white (as my article background) DirectPHP doesnt recognize it as real PHP and everything is SHOWN as is shoud.
Now I have problem (article reader) when select, copy and paste that code from article because I have . behind php tag and code snippet doesnt work :sad:

Any ideas?
Reply | Reply with quote | Quote
+1 # ttttest 2013-07-15 03:00
Holy shit ! Your comment system is cuting all of my messages because I typed some tags ! GRRR ! (My english is really bad
So re-re-re-re fail.

LET'S DO THIS FOR THE FORTH TIME :

Hello,
I've just downloaded your plug-in on Joomla 3.0. It semmed really great. I activated it BUT the p h p code I typed in my contact form article shows me that your plug-in might not be working on my web site.
Do you think you know why ?
Reply | Reply with quote | Quote
+1 # kksou 2013-07-15 08:38
Hi,

DirectPHP is a content plugin. As the name suggests, it's for use within a content article.

You are using contact form, which is another component - not the com_content component used by the Joomla Articles. That's why it will not work.

Regards,
/kksou
Reply | Reply with quote | Quote
0 # Fabu 2013-07-17 04:14
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 Fabu

P.S. I also hope, that you can understand my bad english. I haven't been written a long tim in english.
Reply | Reply with quote | Quote
+1 # kksou 2013-07-24 01:47
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
Reply | Reply with quote | Quote
+3 # LexFaure 2013-07-27 06:49
I would love to use this plugin - and I need just to run the following code:



Which loads and runs an integrated API
But when I run the code - I get the following error:
Parse error: syntax error, unexpected ':' in /home/www/lawyer365.co.za/plugins/content/DirectPH P/DirectPHP.php(58) : eval()'d code on line 1
Reply | Reply with quote | Quote
+2 # JonGauntt 2013-08-19 09:50
I'm trying to work with images so that I can use the following type of string:
Reply | Reply with quote | Quote
+1 # JonGauntt 2013-08-19 10:02
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 < and > 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]
Reply | Reply with quote | Quote
0 # kksou 2013-08-19 19:02
Hi,

Please do something like this (replace all square brackets with angle brackets):

Code:
$now = date('d');
$img = 'dailypic'.$now.'.png';
echo "[img src='$img' alt='text']";


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

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # JonGauntt 2013-08-19 10:03
[from above]
Basically I'm just trying to load a picture of the day so that the website looks like it is changing all the time, but keeping the load times down. Maybe there's a better way to do it? Especially so that I can keep it within the content system as it isn't part of the main framework and will not appear on all pages.
Reply | Reply with quote | Quote
+7 # Marius135 2013-09-04 16:05
Can I use this plugin on a commercial website? I'm creating a site for a customer and I need something like this :)
Reply | Reply with quote | Quote
-1 # CSF-ali 2013-09-11 00:05
How use include command and what is the meaning fullpath ,please describe it with an example.
i use Wampserver and joomla 2.5,and my project folder name is New-p in www ,root directory,where i can uplode my php scripts.
thanks.
Reply | Reply with quote | Quote
+2 # kksou 2013-09-12 03:25
Hi,

What system are you using? Windows? or linux?

Regards,
/kksou
Reply | Reply with quote | Quote
+1 # wanda 2013-09-23 01:14
can you embed a php file? I am using this, but it doesn't seem to work
Reply | Reply with quote | Quote
-2 # Karohuho 2013-10-16 05:32
Hi? Nice plugin, problem here though!
I write the code on the article page(a code that pulls table data from database) but the table doesnt display on the article part, it displays on the footer part.... :sad:
Reply | Reply with quote | Quote
-6 # Karohuho 2013-10-16 06:35
I Just answered myself, didn't close the table
Reply | Reply with quote | Quote
+1 # Richard P 2013-11-01 13:16
Thank you for this component. I am trying to do form validation, which in my current code involves a call back to the same php file to test the users inputs before it is submitted. Is this possible with your component or is there another form validation method you could suggest? Thanks.
Reply | Reply with quote | Quote
+1 # Ekwon 2013-11-09 14:49
Hello.
Thanks for this fantastic component.
Just a little problem. When I call another page from a form, the next php script open in full page and not in the module (which have called this last one) of Joomla. Is this a setting of Joomla to set, or is there a special adjustement to add in the marker of the form (echo ') or elsewhere ?
Thanks.
Reply | Reply with quote | Quote
+1 # kksou 2013-11-10 18:49
Hi,

Please refer to the article: How to display and process forms in a Joomla article using DirectPHP?

and

How to pass variables or parameters from one Joomla article to another using DirectPHP?

Basically you need to pass in additional variables such as option, Itemid, etc. so that Joomla can go back to your designated Joomla page.

Please give it a try and let me know if it works.

Regards,
/kksou
Reply | Reply with quote | Quote
+5 # Ekwon 2013-11-11 01:27
Hi
I've tried what you said. Even with a direct link (
Reply | Reply with quote | Quote
0 # Ekwon 2013-11-11 01:31
I don't why my previous post isn't complete. I said that's not working. I had a great hope about your answer, but :sad:
Reply | Reply with quote | Quote
0 # Ekwon 2013-11-11 12:23
Trying to replace task=view with view=article, it works.
Thanks
Reply | Reply with quote | Quote
-4 # stormy 2013-11-13 13:12
Thank you,this fixed my problem, I have been working for this hour many hours.
Reply | Reply with quote | Quote
-4 # Ekwon 2013-11-13 14:34
Happy to be useful. Thanks to you for this good plugin.
Reply | Reply with quote | Quote
+1 # leyla 2013-11-19 13:19
hi, i've installed this module but it doesnt work. i've tested it on joomla 1.0x with the code but nothing is shown in the frontend :(
can you help?
Reply | Reply with quote | Quote
+3 # ArdiIIa 2014-01-03 09:10
A great extension.

Attention. This extension brings other problems.

DISQUS Comments for Joomla! (by JoomlaWorks)

Php code is displayed and the script will not run
Reply | Reply with quote | Quote
-2 # RITZELY 2014-01-06 10:26
una maravilla :D :lol:
Reply | Reply with quote | Quote
-1 # unknown_guest 2014-01-11 00:16
How can i make directPHP run within modules?
Reply | Reply with quote | Quote
0 # Franko 2014-01-16 15:22
Quoting unknown_guest:
How can i make directPHP run within modules?

Hey your plugin doesn't work on Joomla 3.1 WITHIN MODULES, could you please fix this?

Under joomla 2.5 there is no problem.
Reply | Reply with quote | Quote
-1 # manuvoolapati 2014-01-24 05:13
Hey your plugin doesn't work on Joomla 3.1 WITHIN MODULES, could you please fix this?

Under joomla 2.5 there is no problem.
Reply | Reply with quote | Quote
+3 # Pieter W 2014-01-26 10:15
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 fix_str and fix_str2 and all seems to work okay.
Reply | Reply with quote | Quote
-1 # Dragonrider 2015-10-06 08:00
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.
Reply | Reply with quote | Quote
-3 # Alan 2015-12-28 19:01
The download links seem to be broken. They generate an "invalid link" modal dialog. I look forward to trying this plug in. Thank you.
Reply | Reply with quote | Quote
-2 # kksou 2015-12-29 01:02
Hi Alan,

Have just checked the download links. They are all working fine. Please kindly give it a try again.

For your convenience, have also emailed you a copy of the installer.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
+1 # Alan 2016-01-09 01:02
:-)
I think it was a browser issue. I was able to download it in Chrome. Thanks for sending it to my email and for the follow up. I look forward to trying it.

Thanks again,

Alan
Reply | Reply with quote | Quote
+3 # Marc 2016-01-15 15:11
Hey everybody and thx for this awesome plugin.

I installed it on my site an the for current date/time works fine.
Now I'm trying to insert a custom readmore-link in my articles. Anyone had success with this or can point me in the right directions?

Ty in advance!
Reply | Reply with quote | Quote
+2 # kksou 2016-01-16 02:18
Hi Marc,

May I know what codes you're trying to run? You might want to list some codes here so that people have more clues to see where might be the error. Any error messages that you see on the screen (note: you might need to turn on error_display in php.ini to show the error messages.)

I've also written an article How to debug PHP codes in DirectPHP

You might want to follow some of the recommendations there to debug your PHP code.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
+3 # Marc 2016-01-17 15:23
Hi kksou,

first let me say thanks for your quick reply.
I'm trying to add a custom readmore code to my articles, so i want to make the command available. it works when run the command in the article.php, but its not available when I use it in my articles with direct php.

Regards!
Reply | Reply with quote | Quote
-1 # kksou 2016-01-18 14:41
Hi Marc,

1) May I know what code do you use to "add a custom readmore code"?

2) You mentioned that "it works when run the command in the article.php"? But you also said "its not available when I use it in my articles". A bit confused here. So what works? And what does not work?

Warm Regards,
/kksou
Reply | Reply with quote | Quote
-5 # Marc 2016-01-18 15:11
Hi kksou,

1) I'm trying to use

2) is workking, when I used it in article.php - But it doesnt work after edding to an article in the joomla backend (content / articles)
Reply | Reply with quote | Quote
-1 # Pete 2016-07-08 14:27
Installs easy, works fine. Why can't everything be so simple?
Can't find a 'donate' link... do you have one?
Reply | Reply with quote | Quote
+2 # Kris 2016-07-28 13:00
I've been using DirectPHP on my sites for years with no troubles -- as long as I remember to activate the plugin. :-D

Today I upgraded to 2.5 (Joomla! v. 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? Thanks!
Reply | Reply with quote | Quote
+4 # kksou 2016-08-02 03:09
Hi Kris,

Sincerely apologize for the late reply.

Note sure if you have your problem solved. If not, please refer to the following article: How to debug PHP codes in DirectPHP

As mentioned in the article above, please turn on error_display in php.ini. You should see some warning or error messages on the screen.

Please let me know the error messages so that I have more clues as to what might be the problem.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
-2 # iddy 2016-08-22 21:39
Hi, i'm using phpdirect to call a shortcodes from the database in joomla 3.

The page displays correctly but the shortcodes are not converted - the shortcode itself displays.

if i "view page source" and copy/paste the code directly into a joomla article, the shortcodes work again.

Any ideas whats going wrong ?
Thanks
Reply | Reply with quote | Quote
-1 # kksou 2016-08-24 08:21
Hi Iddy,
May I know what do you mean by "shortcodes"?
Can you please give a sample?
Warm Regards,
/kksou
Reply | Reply with quote | Quote
+5 # Marc Oliveras 2016-10-28 13:11
Thanks for this great plugin. I've read many comments that it is not possible to use it in a Custom HTML module. This is partially true. If you go Custom HTML > Options > Prepare content > Yes this plugin will work on modules too.
Reply | Reply with quote | Quote
0 # kksou 2016-11-09 04:08
Thanks for sharing, Marc!

You can also find more details in the article How to Run Joomla Content Plugins in Custom HTML Modules

Warm Regards,
/kksou
Reply | Reply with quote | Quote
0 # michel jollit 2016-11-14 22:24
I can't use a global variable in a function. it'is not initialized. Do you think it is due todirectphp? if i give it to my function as a parameter it'is ok.
thanks for your reply.
Reply | Reply with quote | Quote
0 # kksou 2016-11-28 09:17
Hi Michel,

DirectPHP uses PHP's standard eval() function. If your script works with eval(), it should work with DirectPHP.

How are you using and declare the global variables?

I've used global variables with DirectPHP and they work fine.

May be if you email me your code, I can try to debug for you.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
-2 # nick 2016-12-23 00:46
Hi, i have a problem with joomla 3.6.
I try this test code in an new
Current date and time is:

No Time is not appearing in an content article.

pls give me a hint
Reply | Reply with quote | Quote
-3 # kksou 2016-12-23 01:32
Hi Nick,

I've tested DirectPHP with the latest Joomla 3.6.5 and it's working fine.

First of all, make sure that the DirectPHP plugin is enabled.

If it's enabled, then please turn on display_errors in your php.ini and let me know what errors and warning messages you see on the screen.

You can do this in your php.ini, or you can include them right in your PHP script by adding:
Code:ini_set('display_errors', 1);
error_reporting(E_ALL);


You can find more details here: How to debug PHP codes in DirectPHP

When you see the error/warning messages on the screen, please let me know so that I have more clues to where might be the problm.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
-6 # Marv V 2017-04-25 18:21
on Joomla 3.7 i got error

0 - Call to undefined function mysql_query()

Call stack
# Function Location
1 eval() JROOT/plugins/content/DirectPHP/DirectPHP.php:60
Reply | Reply with quote | Quote
-1 # kksou 2017-04-27 09:54
Hi Marv,

DirectPHP uses standard PHP eval() function. DirectPHP itself does not have any mysql_query() statement. That's from the PHP code you are trying to run using DirectPHP.

Please refer to the article How to debug PHP codes in DirectPHP

Turn on Error Display to find out the real error messages for your PHP codes.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
+1 # Fabrizio 2017-09-25 10:08
Hi kksou,
DirectPHP worked fine before upgrading to Joomla 3.8.0.
With this version, I found that it's "sending" php code twice - I verified this by printing $phpcode variable in your code, it displays (and executes) the code twice, so function declarations return error ("function already declared"), DB insert calls insert the same record twice, etc.

Thank you for any hint
Ciao

Fabrizio
Reply | Reply with quote | Quote
+5 # Fabrizio 2017-09-26 18:52
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 https://github.com/joomla/joomla-cms/pull/18066/files/e8e03290a90b46213e0f4ad890ef8bea1e8e0e5b, 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!

Ciao

Fabrizio
Reply | Reply with quote | Quote
-1 # kksou 2017-09-28 13:16
Hi Fabrizio,
Glad you found the solution!
And thanks for sharing this solution with me. I'm sure this will benefit many others too!
Warm Regards,
/kksou
Reply | Reply with quote | Quote
-1 # Steve 2018-01-01 12:17
Hi kksou,
I'm trying to install DirectPHP 3.01 to Joomla 3.7 but keep getting a "Please enter a package folder.
Unable to find install package" error message when I try to install from the unzipped folder. I fear I'm doing something obvious wrong. Thanks for help.
Reply | Reply with quote | Quote
0 # kksou 2018-01-03 03:10
Hi Steve,

Happy New Year!

1) Download the installation file from: DirectPHP v3.0
Make sure you download the one for Joomla 3.0.

2) Save the file to your local machine. The filename should be DirectPHP_v3.01.zip

3) Go to Extensions Manager - Install.

4) Click the first tab "Upload Package File". You can drag and drop the file "DirectPHP_v3.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
Reply | Reply with quote | Quote
-4 # Lukasz 2018-01-14 20:42
HI
I want to input my php code to Joomla 3.8.3 but I have some Error.
Plugion is working for sure simply code echo 123 is showing, but when I put into Module manager my php code I've that error:
Fatal error: Call to a member function array() on null in /kolumb/plugins/content/DirectPHP/DirectPHP.php(60 ) : eval()'d code on line 3

And my PHP code is:


Tell me please what shell I do ??
Reply | Reply with quote | Quote
+4 # kksou 2018-02-03 10:18
Hi Lukasz,

1) You said echo "test 123"; works in plugin.
2) Does echo "test 123"; works in module too?

Please refer to the article How to debug PHP codes in DirectPHP

Turn on Error Display to find out the real error messages for your PHP codes.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
+2 # Mark Hobbs 2018-02-02 03:28
This plugin works. I have a weird bug...

When I paste the php code into the code box in joomla, it disappears after the article is saved. The code executed when the article is loaded on the front end, but if the article is loaded on the back end, it is empty (if I save the empty article, the code disappears).

Is this normal?

Mark
Reply | Reply with quote | Quote
+3 # kksou 2018-02-02 04:30
Hi Mark,

Please refer to the following article:

1) How to Stop Joomla From Stripping Out Code

2) Try JCE Editor (It's free and good): Scripts removed on saving

3) How to use javascript in articles?

Please give the above a try and let me know if it works.

Warm Regards,
/kksou
Reply | Reply with quote | Quote
+2 # Mark Hobbs 2018-02-04 22:44
/kksou

I 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 Profiles
open the default profile
go to editor parameters -> advanced
set "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
Reply | Reply with quote | Quote
-2 # kksou 2018-02-05 00:33
Hi Mark,

Thanks much for sharing about creating additional profiles in JCE Editor.

I'm sure many other users will find this useful!

Warm Regards,
/kksou
Reply | Reply with quote | Quote
-3 # John 2018-03-20 00:42
Got the plugin installed and enabled.

Now I need to set to No Filtering. Where do I do this in Joomla 3.8.6?

Thanks.
Reply | Reply with quote | Quote
+3 # kksou 2018-03-21 08:06
Hi John,

It's in Global Configurations - Text Filters tab

If you're using JCE Editor, then please refer to the following article: Scripts removed on saving

Warm Regards,
/kksou
Reply | Reply with quote | Quote
-4 # Hieu 2018-03-21 08:11

How can i use ob_start() to echo real time value?
Thanks you for support
Reply | Reply with quote | Quote
+1 # Mark Hobbs 2019-04-08 17:16
I've used DirectPHP for a few years... it's beautifully simple and convenient.

I recently decided to use DirectPHP to make PDFs with TCPDF. If I put the following code in a file and run it directly on the server, it works fine, but within an article, it just echos the data. Any advice?

require_once(JPATH_ROOT.'/libraries/tcpdf/tcpdf.php');
$pdf = new TCPDF('P','mm', 'A4');
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
$pdf->AddPage();
$pdf->Output('htmlout.pdf', 'I');
Reply | Reply with quote | Quote
+2 # kksou 2019-04-21 16:05
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 display_error and error_reporting in PHP.ini so that you can see the error messages displayed on the screen.
Code:error_reporting(E_ALL);
Code:ini_set('display_errors', 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
Reply | Reply with quote | Quote
+4 # Ruediger Schultz 2021-10-24 12:41
Hello Friend,
as you know, we heavily depend on DirectPHP for our various applications (one of the most complex ones being the Portal to the Heritage of Astronomy ( https://www3.astronomicalheritage.net/ ).
I wonder if you had time to look into the issues of DirectPHP with Joomla4 and if you plan to solve them?
What I found are issues with getting the plugin parameters , as $this->params is deprecated by Joomla.
Kind regards
Ruediger Schultz
Reply | Reply with quote | Quote
-2 # Ruediger Schultz 2022-03-15 09:31
Hello friend,
I am using DirectPHP for more than a decade now, on various projects - it is very valuable for me. Thanks!
I am investigating the transition to Joomla4 and I found that the plugin has an issue with this. Do you plan to update the plugin soon?

Kind regards and thank you again
Ruediger Schultz
Reply | Reply with quote | Quote
+3 # kksou 2022-04-13 04:58
Dear Ruediger,

Sincerely apologize for the late reply. I must admit that I haven't log on to the kksou.com for years. I started kksou.com as a hobby back in 2005. Life became busy and I had almost no time to continue the hobby.

I wrote the first version of DirectPHP back in 2008. I wanted to embed some PHP codes in my own websites. Couldn't find a simple and easy-to-use one. So I wrote this. I thought this might be useful to others. That's why I decided to share this plugin on https://extensions.joomla.org.

I was actually very surprised that this plugin is still in use. At that time, there were many commercially available plugins by professional developers. Thought there would be even more such plugins after all these years.

In any case, thanks for your support for DirectPHP for so many years. I saw that you have also written to me back in 2016. Just to share with you, I do receive requests every now and then to update DirectPHP and my other plugin googleMaps. However, I was overloaded with work and projects. I kept all these emails in a folder but never had the time to work on them.

This morning I happened to have some time. I saw your email. I decided to log on to the administrator website of kksou.com, after so many years. I found the 2 messages that you've posted - one in Oct 2021 , and the other in Mar 2022. Yes, I was touched by your persistence. I also liked your [url=https://www3.astronomicalheritage.net ]UNESCO Astronomy and World Heritage a lot. Although life is still as busy, I have decided to work on this to make DirectPHP work for Joomla4.

Not sure if you have the solution for the error message you've pointed out.

If not, please give me some time. I need to install a copy of Joomla 4 so that I can test out the plugin.

Will let you know once I have the new version working.

Warm Regards,
/kksou
Reply | Reply with quote | Quote

Add comment


Security code
Refresh