We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Quote from: zi at Nov 25, 2009, 04:40 AM

    Quote from: BobRay at Nov 24, 2009, 10:14 AM

    Thought I’d mention that in MODx Revolution, there are real categories that can be attached to resources or elements and they are much more tag-like than in Evolution. I think the conversion would be much more straightforward in Revolution.
    BobRay, I dont think categories are available for "Resources" aka Documents. We have to go for TV based categories since a post can be in 2 or more categories.

    But I have played with Revolution lot less than you ofcourse tongue

    No, you’re absolutely right Zi . I was full of crap when I said that. embarrassed

    Sorry for the confusion.
      Did I help you? Buy me a beer
      Get my Book: MODX:The Official Guide
      MODX info for everyone: http://bobsguides.com/modx.html
      My MODX Extras
      Bob's Guides is now hosted at A2 MODX Hosting
      • 28159
      • 22 Posts
      Okay. First alpha version done. The forum wouldn’t let me upload the .zip file, so you’ll have to download it instead:

      http://www.smalldog.be/sandbox/wp2modx.zip

      Some notes:

      1) This is alpha. Alpha, alpha, alpha. I’ve only tested it on my own blog. Use at your own risk. For me, it works.

      2) This is NOT a snippet. It’s a separate PHP script that doesn’t integrate into ModX at all (at the moment).

      3) Since it’s alpha, and since it’s made mostly for my own use, it’s rough and ready. You shouldn’t need any particular knowledge of PHP to run it, but you will need knowledge of how to edit a text file, and decent knowledge of how your WordPress database is set up. If you’re familiar with phpMyAdmin or another web-based mySQL database management tool, you’re definitely good to go.

      4) Feedback very welcome. I’m sure I’m not the only person who needs/wants this functionality, so with some fine tuning and community help, maybe it could be made user-friendly and more automated.



      Copy/pasted below is some information from the script itself. Please read through it before using the script:

      /*  INSTRUCTIONS
       *
       *	1.  Fill in the Configuration section variables (below).
       *
       *      2.  Upload this script to the webserver on which your WordPress
       *          mySQL database is located.
       *
       *	3.  Access the wp2modx.php script via your webbrowser.  (I.e. if you 
       *	    uploaded it to www.domain.com/mysite/wp2modx.php, then go to 
       *      www.domain.com/mysite/wp2modx.php in your webbrowser.)
       *
       *	4.  If the script is able to run successfully, it will create a new
       *      file in this same directory called "wp2modx_import_data.txt"
       *
       *	5.  Access your ModX mySQL database (generally via phpMyAdmin or such).
       *
       *	6.  Use an 'import' function to import the data of the wp2modx_import_data
       *      file.
       */
       
       
      /*  ASSUMPTIONS
       *
       *  This script was created with particular assumptions in mind:
       *
       *  1.  That you have two (or three) ModX template variables _already_ created:
       *
       * 'tags':  used to store WordPress tag information.
       * 'categories':  used to store WordPress category information.
       * 'keywords':  used to store All-In-One SEO keyword information.  (With AIOSEO only)
       *
       *  You will need to know the _ID number_ of these template variables in ModX.
       *  The ID numbers can be seen in the ModX Manager panel, under the
       *  "Elements" =>  "Manage Elements" =>  "Template Variables" section.
       *
       *
       *  2.  All documents which are migrated are assumed to belong to the same, single author.
       *  (That is, we assume WordPress is a one-person blog.)  This author is assumed to
       *  be the main administrative user of ModX  (userid "0").
       *
       *  Functionality to migrate content to multiple users can likely be added later.
       *
       *
       *  3.  That you will manually transfer/import the resulting text file to the
       *  ModX database.  Most MySQL databases will only allow connections from the
       *  localhost.  Thus, if your WordPress and ModX installations are on different
       *  webservers, this is an absolute necessity.  
       *
       *  The script could be modified to do the entire migration automatically,
       *  if the WordPress and ModX installations are on the same server.  I haven't
       *  done that.
       *
       */
       
       
       /*  IDEAS FOR FUTURE VERSIONS
        *
        *  - Do not process WordPress posts in certain categories / with certain tags
        *  - Automatically migrate content if WP and ModX share the same server.
        *  - Create ModX Template Variables if they are not already present.
        *
        */ 
        
        
       /*  CLOSING NOTES 
        *
        *  - This script will not process WordPress posts which have the post_status
        *    'inherit'.  These are revisions, and ModX Evolution 1.0.0 does not 
        *    support version control as of this writing.
        *
        *  - Relative links and URLs (for images, etc.) _may_ break.
        *
        *  - I'm a self-taught programmer and don't do OOP.  As such, the program
        *    could probably be vastly improved regarding modulization and OOP
        *    techniques.  But it works.
        *
        */  
      
        • 27708 MODX Staff
        • 2,502 Posts
        Thanks for posting. Would you like or be interested in having this built out as a module or having a front End? It make sense to me to have some sort of front end to run the process either inside or outside MODx.

        I’d be interested in what others think.

        Cheers,

        Jay
          Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
          • 28159
          • 22 Posts
          A front end would definitely be useful, as then you could input the necessary configuration fields in a form rather than editing the file directly.

          I’m not sure about the possibility of turning it into a module. The problem I ran into was primarily that, if your WordPress and ModX installations are on different servers, there’s no way to make a connection to both of them at the same time (that I know of). Most database servers only allow connections from localhosts.

          Of course, if you *do* have the same server for both, then getting WordPress data from ModX is no problem.

          Also interested in others’ thoughts (and if it works for others as well).
            • 25663 MODX Staff
            • 12,272 Posts
            I’d think that a pretty common scenario would be having both installs on the same server.
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 3749
              • 24,544 Posts
              Quote from: spellsmith at Nov 30, 2009, 02:48 PM

              A front end would definitely be useful, as then you could input the necessary configuration fields in a form rather than editing the file directly.

              I’m not sure about the possibility of turning it into a module. The problem I ran into was primarily that, if your WordPress and ModX installations are on different servers, there’s no way to make a connection to both of them at the same time (that I know of). Most database servers only allow connections from localhosts.

              Of course, if you *do* have the same server for both, then getting WordPress data from ModX is no problem.

              Also interested in others’ thoughts (and if it works for others as well).

              On separate servers, you could always export to a .SQL file and import on the other server.
                Did I help you? Buy me a beer
                Get my Book: MODX:The Official Guide
                MODX info for everyone: http://bobsguides.com/modx.html
                My MODX Extras
                Bob's Guides is now hosted at A2 MODX Hosting
                • 27708 MODX Staff
                • 2,502 Posts
                You can connect to Wordpress using an XMLRPC client script but you won’t be able to get all the meta data that way. You can certainly grab all the content and custom field data and most of the main data. I’d have to look into it but IIRC almost all blog importers work this way vs accessing the db directly.

                Since yours is accessing the db directly I think it makes sense just to limit a UI for same server migrations for now as Ryan (rthrash) is right that many people will certainly install MODx alongside WordPress on the same server while they are building the new site.
                  Author of zero books. Formerly of many strange things. Pairs well with meats. Conversations are magical experiences. He's dangerous around code but a markup magician. Blog ✦ Twitter ✦ LinkedIn ✦ GitHub
                  • 36527
                  • 120 Posts
                  What about Wordpress MU? Could this be a future feature?
                    • 29256
                    • 20 Posts
                    Hy!

                    I can't download the script :S Because the server is currently unavailable.