We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 34017
    • 898 Posts
    Quote from: Ynotmodx at Mar 18, 2009, 06:09 PM


    Its also a matter of making the community stronger. I pose the question again. What stops the gurus from converting a number of the php scripts with some specific functionalities found at hotscripts and elsewhere into modx snippets and sharing with the community?


    I agree with Ryan and Bob here. It’s time. Most addons are created because it fits a need for our clients whether the addon is ManagerManager, Ditto, eForm, Wayfinder, etc. modx allows me to be pretty busy making beautiful, unique websites. If a client needs custom functionality, I can do that and release it to the community where needed. But modx does most of what I need without needing to make custom addons. I can use ditto, eform, and wayfinder with some api calls to do whatever i need. The wiki has a great list and examples of most of the api calls you would need.

    So what stops us? nothing but time. If a client needs it, we can create it simply- their happy.
      Chuck the Trukk
      ProWebscape.com :: Nashville-WebDesign.com
      - - - - - - - -
      What are TV's? Here's some info below.
      http://modxcms.com/forums/index.php/topic,21081.msg159009.html#msg1590091
      http://modxcms.com/forums/index.php/topic,14957.msg97008.html#msg97008
      • 33160
      • 24 Posts
      Ok at BobRay, we are getting somewhere..

      Can you make out sometime and give me the procedure for converting a full php script to modx snippet? I have seen your blog and your tutorials commendable. You have a snippet tutorial there

      But what if have a php script that maybe makes a small hotel booking system. How does one go about converting it? One can pick up bits of php and of course sometimes there wont be a need for reinventing the wheel. But in the above situation am talking about, there maybe bits of the php that requires some modx tags or api to be able to perform as snippets. These are the tips and aids am talking about.

      If i can use any php script, no matter how complex, and use as snippet, i wouldnt be asking.

      Nevertheless, its getting clearer to me why things are the way it is here.
        • 20413
        • 2,877 Posts
        The main reason to convert existing PHP into MODx and make it CMS’ified would be
        if you wanted the client to edit it. Plenty of modx websites uses external scripts and apps that
        has nothing to do with MODx itself.

        The best documentation for MODx by far ---> http://www.w3schools.com/
          @hawproductions | http://mrhaw.com/

          Infograph: MODX Advanced Install in 7 steps:
          http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

          Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
          http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
          • 33160
          • 24 Posts
          @mrhaw

          Thanks for the reply. So you are saying in essence that i can use my php script together with modx without converting it to snippet? Would php include work? To include a standalone php script into modx templates?

          I design sites. My challenge is in the programing bits.

            • 20413
            • 2,877 Posts
            You can run and style the external stuff from folders _inside_ your domain and have a very matching output.

            But before you do make a search
            http://www.google.com/search?hl=sv&q=%22awesome+application%22+site%3Amodxcms.com&lr=

            and post a topic here: http://modxcms.com/forums/index.php/board,3.0.html

            and don’t forget to check out: http://modxcms.com/forums/index.php/board,179.0.html
              @hawproductions | http://mrhaw.com/

              Infograph: MODX Advanced Install in 7 steps:
              http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

              Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
              http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
              • 33160
              • 24 Posts
              Yes , you can see i edited my post to remove the w3school comment after i saw the php/ mysql tab

                • 22303 MODX Staff
                • 10,725 Posts
                Quote from: Ynotmodx at Mar 18, 2009, 08:09 PM

                But what if have a php script that maybe makes a small hotel booking system. How does one go about converting it? One can pick up bits of php and of course sometimes there wont be a need for reinventing the wheel. But in the above situation am talking about, there maybe bits of the php that requires some modx tags or api to be able to perform as snippets. These are the tips and aids am talking about.

                If i can use any php script, no matter how complex, and use as snippet, i wouldnt be asking.
                Unfortunately, there is no clear path to converting scripts that were not designed to run in MODx here, because it completely depends on the scope of the script, what it does, how it uses the database (if it does at all), and many other factors that are outside of our control. To be honest, most simple scripts that do not use a database are very easy to convert, typically requiring some simple changes in include paths if it was expected to run in it’s own directory. Of course, this becomes much easier once you take the time to become familiar with MODx, how it works, and the scope of the features it provides.

                But with more complex scripts, it’s going to have to be case-by-case evaluations, as there are no real fundamental standards for PHP components as there are in, for instance, Java web applications. So there’s really no "silver bullet" for converting existing scripts to MODx add-ons and in some cases, it simply doesn’t make sense to convert them. There may be other ways to use more complex (i.e. those with their own user systems, database connections, templating engines, etc.) scripts side-by-side with MODx, or easier ways to recreate the functionality in a purely MODx fashion.
                  • 3749
                  • 24,544 Posts
                  Quote from: Ynotmodx at Mar 18, 2009, 08:09 PM

                  Ok at BobRay, we are getting somewhere..

                  Can you make out sometime and give me the procedure for converting a full php script to modx snippet? I have seen your blog and your tutorials commendable. You have a snippet tutorial there

                  But what if have a php script that maybe makes a small hotel booking system. How does one go about converting it? One can pick up bits of php and of course sometimes there wont be a need for reinventing the wheel. But in the above situation am talking about, there maybe bits of the php that requires some modx tags or api to be able to perform as snippets. These are the tips and aids am talking about.

                  @Ynotmodx: Thanks for the kind words. I’m afraid there’s no simple answer to this because it depends on the script. A really simple php script (say one that prints the current time) can just be pasted into a snippet and a snippet call will put the time on your page. Many php scripts, though, are much more complex and require more work to convert. Your small hotel booking system is probably not a single php script but a number of them in separate files. How hard it would be to convert to a MODx snippet would depend on how it was designed (and how well it was implemented). A well-written object-oriented script can be easy to convert. A sloppy mess of code can be a nightmare to convert.

                  It’s often possible to do what you want using existing MODx components. When that isn’t possible and there is an open-source script out there that does what you want, you can ask here and, if you’re lucky, someone else might convert it to a MODx snippet for you out of curiosity, their own need, or just to be helpful.



                    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
                    • 8609
                    • 607 Posts
                    This is an interesting discussion. I am by no means a PHP expert, if anything I’m less than a novice, but I’m learning fast wink. The main CMS that I use is Drupal and you can see on my tracker at the Drupal website and on my blog that I devote a lot of time to learning it and teaching people what little I know. Recently I’ve been delving into MODx, and I agree with you, you need to know what you’re doing with MODx, it’s not plug and play, but it is powerful and flexible. And as I learn more I’m itching to share it with others, and will be doing a series of MODx tutorials on my blog soon.

                    While I understand what the OP is saying, I also think we don’t need another Drupal, or another Joomla, etc. We do need to work on the documentation,and continue to build up the contributed code, and that’s a community effort. If you’re interested enough to critique the system (which is not a bad thing, notice I didn’t say criticize, I said critique), then you’re interested enough to roll your sleeves up, jump in, and play!

                    Anyway, I have a lot more thoughts on this but I’ve had a long day. I just wanted to throw my initial 2cents in so that I can stay subscribed to this thread. I’ll probably add more thoughts later.
                      • 33160
                      • 24 Posts
                      Thanks all for contributing. As i discuss here, I have opened up numerous forum threads to try and see what i can learn.

                      @BobRay and OpenGeek

                      When i design websites with .php extension as oposed to .html, i am able to include small bits of php scripts to the web page using require or include. Would that cause an error in modx? I am just looking at alternatives and not be fixated at the converting snippets issue.