We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22702
    • 3 Posts
    Hey guys,

    I’ve found several tutorials on the web that were inadequate at explaining how to create a component. They were missing whole sections or were out of date. I’m not a newbie with PHP, I’ve been programming for over 5 years and have even built my Object Oriented framework.

    Is there any "hello world" tutorial out there? If not, I’d be willing to write a comprehensive one if someone from the community was willing to help me out on this.
      • 28215
      • 4,149 Posts
      For Revo or Evo?
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 30491
        • 44 Posts
        For revo perhaps?

        I’ve been pulling my hair out trying to put together a modx addon (a nifty portfolio addon that i’ve put together). For the life of me, it just seems so complex lol. everything is working fine on the front-end, I’m just having colossal trouble putting together the backend.

        Any good tutorials on that? i mean really simple, barebone tutorials.
          • 3749
          • 24,544 Posts
          If you really want a "Hello World" tutorial . . .

          Here’s a fairly sketchy one that should work for either Evo or Revo (all I have time for right now):

          Create a document called "HelloWorld"

          Add this text and snippet tag to the Content field of the HelloWorld document:


          <p>Here's the output that replaces the snippet tag: [[HelloWorldSnippet]]</p>


          Create a snippet called "HelloWorldSnippet" with the following code:

          <?php
          $output = 'Hello World!';
          
          return $output;
          ?>
          


          Right-click on the HelloWorld document in the tree at the left and select "Preview." smiley
            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
            • 30491
            • 44 Posts
            haha smiley
            thank you for that helpful tutorial smiley Nah on a serious note, It would be nice to have a full tutorial from front-end to back-end (no pun)-- something really simple.

            There was a ’Doodles’ tutorial (by Shaun McCormick aka splittingred)
            , but it appears to be applicable to the older version of Modx Revolution (the alpha version?). Doodles seemed like the closest thing to a backend tutorial but its depreciated.
            http://svn.modxcms.com/docs/display/~splittingred/2008/07/10/Creating+Custom+Manager+Pages+for+a+3rd+Party+Component,+Pt.+I


            It would be helpful to create a tutorial that encompasses some simple script, with basic mysql/php interaction. List/Add/Edit/Delete, from both front and back-end.

            peeace
              • 28215
              • 4,149 Posts
              splittingred Reply #6, 14 years ago
              I’ll make sure to update that this week to work with the latest Revo.
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 30491
                • 44 Posts
                awesome! eagerly looking forward to it!

                million thanks to you and the rest of the modx developers.

                :)

                (im actually on the Custom Manager tutorial as we speak, lool, trying hard to get it to work but to no avail haha)

                peace
                  • 28215
                  • 4,149 Posts
                  splittingred Reply #8, 14 years ago
                    shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                    • 28215
                    • 4,149 Posts
                    splittingred Reply #9, 14 years ago
                    I’ve committed an example script called "Doodles" that does based CRUD actions in the mgr, as well as has a front-end snippet that lists "Doodles", here:

                    http://svn.modxcms.com/svn/modx-components/doodles/trunk/

                    Looking at those files may help your understanding.
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                      • 30491
                      • 44 Posts
                      Hey Shawn! thanks a million
                      I’ve downloaded it and already sinking my teeth into it as we speak smiley

                      There several errors to note. $sources[’elements’] isn’t defined and that generates an error when the script is packaged. Fixed that by adding
                      'elements' => $root.'core/components/'.PKG_NAME_LOWER.'/elements/',

                      in line 34 of build.transport.php
                      Also get getSnippetContent doesn’t seem to work (in line 14 of transport.snippets.php, replaced it with ’file_get_contents’ and that worked.

                      the package is built but I still get a host of errors mainly concerning ’resolvers’. Also I get a parse error when I call the doodle script [[doodles]]
                      also get this parse error...haha enough about the errors though...many thanks shawn..
                      Parse error: parse error in C:\Program Files (x86)\wamp\www\modx\core\cache\elements\modsnippet\9.include.cache.php on line 7
                      ---------------------Errors------------
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Created new transport package with signature: doodles-1.0-beta1
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Registered package namespace as: doodles
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Packaged namespace "doodles" into package.
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Packaging in snippets...
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Adding file resolvers to category...
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Packaging in lexicon...
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Auto-building in lexicon from path: C:\Program Files (x86)\wamp\www\modx\doodles/core/components/doodles/lexicon/
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Packaging in menu...
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Adding in PHP resolvers...
                      [2010-04-19 23:36:43] (ERROR @ C:\Program Files (x86)\wamp\www\modx\core\xpdo\cache\xpdocachemanager.class.php : 268) PHP warning: copy(C:\Program Files (x86)\wamp\www\modx\doodles/_build/resolvers/resolve.paths.php) [function.copy]: failed to open stream: No such file or directory
                      [2010-04-19 23:36:43] (ERROR @ /modx/doodles/_build/build.transport.php) xPDOCacheManager->copyFile(): Could not copy file C:\Program Files (x86)\wamp\www\modx\doodles/_build/resolvers/resolve.paths.php to C:/Program Files (x86)/wamp/www/modx/core/packages/doodles-1.0-beta1/modMenu/b153ab07a093097f379f6904930dfdf0.resolve.paths.resolver
                      [2010-04-19 23:36:43] (ERROR @ /modx/doodles/_build/build.transport.php) Source file C:\Program Files (x86)\wamp\www\modx\doodles/_build/resolvers/resolve.paths.php is missing or C:/Program Files (x86)/wamp/www/modx/core/packages/doodles-1.0-beta1/modMenu/b153ab07a093097f379f6904930dfdf0.resolve.paths.resolver could not be written
                      [2010-04-19 23:36:43] (ERROR @ C:\Program Files (x86)\wamp\www\modx\core\xpdo\cache\xpdocachemanager.class.php : 268) PHP warning: copy(C:\Program Files (x86)\wamp\www\modx\doodles/_build/resolvers/resolve.tables.php) [function.copy]: failed to open stream: No such file or directory
                      [2010-04-19 23:36:43] (ERROR @ /modx/doodles/_build/build.transport.php) xPDOCacheManager->copyFile(): Could not copy file C:\Program Files (x86)\wamp\www\modx\doodles/_build/resolvers/resolve.tables.php to C:/Program Files (x86)/wamp/www/modx/core/packages/doodles-1.0-beta1/modMenu/b153ab07a093097f379f6904930dfdf0.resolve.tables.resolver
                      [2010-04-19 23:36:43] (ERROR @ /modx/doodles/_build/build.transport.php) Source file C:\Program Files (x86)\wamp\www\modx\doodles/_build/resolvers/resolve.tables.php is missing or C:/Program Files (x86)/wamp/www/modx/core/packages/doodles-1.0-beta1/modMenu/b153ab07a093097f379f6904930dfdf0.resolve.tables.resolver could not be written
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Adding package attributes and setup options...
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) Packing up transport package zip...
                      [2010-04-19 23:36:43] (INFO @ /modx/doodles/_build/build.transport.php) 
                      
                      Package Built.
                      
                      Execution time: 0.8349 s