We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16183
    • 1,390 Posts
    Hi folks,

    I’ve recently resumed learning PHP of which I have a fairly good grasp of the basics. The whole motivation of resuming the lessons is actually MODx.

    Now, I know some may say, "you learn your PHP first, then get into implementing those in MODx". Well, I want to do this side by side. Basically, as part of my learning process, I want to develop, test, apply, etc some-not-so-complex 3rd party PHP (logic scripts and classes) using the MODx API. The scripts are not limited to those developed for MODx though.

    My question is how to best set up a developing environment in Eclipse whereby I will be able to make use of the modx object, API etc. Say, for instance, I want to test a MODx snippet in Eclipse, I want to be able to do this within Eclipse and not have to copy and paste the code in the MODx manager in order to test/parse it. Is this possible? How can I go about this? I am not sure whether to reference the modx files or include them in the project I am working on? If am working on several projects, including the modx files in all of the projects doesn’t seem the smartest way to do this?

    Many thanks.

    My IDE =>Eclipse for PHP Developers
    Apache HTTP Server 2.2.11
    PHP 5.2.10 (with a moded php_mysql.dll and php_mysqli.dll for use with MySQL 5.1.30+ and PHP 5.2.9+)
    MySQL 5.1.35
    phpMyAdmin 3.2.0

    All the above are separately installed. I am not using WAMP2 server or similar. (MODx Evolution and 0.9.6.3 installed and running fine in the above WAMP environment).

    cheers/k
      • 22303 MODX Staff
      • 10,725 Posts
      Quote from: kongondo at Jun 28, 2009, 09:54 AM

      Now, I know some may say, "you learn your PHP first, then get into implementing those in MODx". Well, I want to do this side by side. Basically, as part of my learning process, I want to develop, test, apply, etc some-not-so-complex 3rd party PHP (logic scripts and classes) using the MODx API. The scripts are not limited to those developed for MODx though.

      My question is how to best set up a developing environment in Eclipse whereby I will be able to make use of the modx object, API etc. Say, for instance, I want to test a MODx snippet in Eclipse, I want to be able to do this within Eclipse and not have to copy and paste the code in the MODx manager in order to test/parse it. Is this possible? How can I go about this? I am not sure whether to reference the modx files or include them in the project I am working on? If am working on several projects, including the modx files in all of the projects doesn’t seem the smartest way to do this?
      This is not really possible with MODx 0.9.x/1.0 (Evolution). Snippets are dependent on the execution environment that is provided by the MODx request handling. It is a little more feasible in MODx 2.0 (Revolution), but you would have to instantiate the modX object, initialize a context, and initialize the parser in order to use it.

      You should explore setting up and learning how to use xdebug with remote debugging in Eclipse. It’s also great for profiling specific requests and tracing code execution; makes it much easier to find bottlenecks in your code. BTW, I personally recommend PHPEclipse for PHP editing. I avoid the Zend/IBM PDT extension like the plague; they hold too many features hostage for the commercial versions of their products IMO.
        • 16183
        • 1,390 Posts
        Jason,

        Thx for the quick reply and the pointers. I think I will stick to testing in the manager then and explore using xdebug. I’ll have a look at PHPEclipse for comparison.

        cheers/k