We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 21872
    • 95 Posts
    Generally, I like to learn by finding good examples and working out why they work. The question that prompted this was going to be "how do I write a snippit that has one output if a user is logged in and another if a user is not?" But, because I can’t figure that out from looking at the documentation, I must not have enough prerequisites to even understand the documentation.

    There is nothing trivial in Revo and the API is clearly for experienced php developers, not novices who barely understand the syntax, let alone the level or purpose of abstraction exhibited. I don’t want to ask every basic question I have and hope for an answer, I want to find a reliable resource and learn what I need to know. I’d appreciate suggestions that will help an imbecile grok enough of the basics of the general language and the specific concepts used in Revolution to enable me to make sense of the API.
      • 20413
      • 2,877 Posts
      Related thread http://modxcms.com/forums/index.php/topic,47278.msg278875.html#msg278875
      I know @BobRay is writing a book and @OpenGeek, @splittingred & Co. doing their best to write documentation.
      I guess if more people signed up to contribute documentation, we wouldn’t need to use google as much to find hidden answers in the forums.
        @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
        • 28215
        • 4,149 Posts
        The best place is to ask on the forums. Other than that, suggest or write tutorials.

        You dont need to write a snippet, tbh. Just use the If snippet (in Addons -> Utilities)

        [[!If?
           &subject=`[[+modx.user.id]]`
           &operator=`empty`
           &then=`Not logged in.`
           &else=`Logged in.`
        ]]
        


        Or, if you really wanted to do it in a snippet:

        if ($modx->user->hasSessionContext($modx->context->get('key'))) {
           /* they're logged in */
        
        } else {
         /* not logged in */
        }
        
          shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
          • 2611
          • 394 Posts
          Hey,

          You’re talking about learning PHP, as a language. And not specificly learning just the ModX API. You want to learn "just about enough" of a language to understand an API that is developped by highly skilled people. I think when you learn ’just about enough’ you already know basicly all of PHP smiley

          There are some good places to start though:
          - http://www.w3schools.com/php/default.asp
          - http://www.tizag.com/phpT/

          Personally i also learned from examples and ALOT from just doing it. PHP’s learning curve is not very steep and you should know your way around in 2 months tops.
          I think then, the API makes a lot more sence and the stuff you want to create on it will be very very easy.
            Follow me on twitter: @b03tz
            Follow SCHERP Ontwikkeling on twitter: @scherpontwikkel
            CodeMaster
            • 1886
            • 1 Posts
            I think php tutorial can be enough for you