We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31471
    • 206 Posts
    I can’t find info about what objects are available on different plugin events.
    For example, onWebPagePrerender setting a placeholder, does like to kiss a dead...
      • 3749
      • 24,544 Posts
      Quote from: vhollo at Sep 24, 2010, 09:58 PM

      I can’t find info about what objects are available on different plugin events.
      For example, onWebPagePrerender setting a placeholder, does like to kiss a dead...

      In Revo, you can pretty much count on the relevant object being available using the name of the object -- $resource, $user, $chunk, $snippet, etc. You can get any of the fields with its get() method. You’ll also have the object’s ID in the $id variable.

      If you do a search of the MODx code (e.g. with NetBeans) for the name of the event, you can see what variables are being passed to it.
        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
        • 31471
        • 206 Posts
        Quote from: BobRay at Sep 25, 2010, 04:59 AM

        If you do a search of the MODx code (e.g. with NetBeans) for the name of the event, you can see what variables are being passed to it.

        Thanks a lot for the tip, Bob! I wouldn’t know about this great tool, which I look at it now as my new best friend. Of course MODx is still the bestest cool
          • 28554
          • 201 Posts
          I think you guys can really learn from the structuring of the ExpressionEngine User Guide. I think in general there’s two types of documentation-readers: first-timers / learners who want to get to know MODx and already-users who want a good reference guide. I fall into the latter category, and often need a reference because I use alot of CMS’es depending on the job at hand (MODx, ExpressionEngine, CMS Made Simple, MojoMotor, Wordpress). I had a really really hard time finding a list of available system tags (such as [[*description]], [[*pagetitle]] etc.), and eventually just gave up and resorted to a site I had built earlier. That’s a really annoying situation. Maybe we can set up a "quick reference chart" of available standard tags, and some standard methodology / tips...
          • never got the cheatsheet?
              Rico
              Genius is one percent inspiration and ninety-nine percent perspiration. Thomas A. Edison
              MODx is great, but knowing how to use it well makes it perfect!

              www.virtudraft.com

              Security, security, security! | Indonesian MODx Forum | MODx Revo's cheatsheets | MODx Evo's cheatsheets

              Author of Easy 2 Gallery 1.4.x, PHPTidy, spieFeed, FileDownload R, Upload To Users CMP, Inherit Template TV, LexRating, ExerPlan, Lingua, virtuNewsletter, Grid Class Key, SmartTag, prevNext

              Maintainter/contributor of Babel

              Because it's hard to follow all topics on the forum, PING ME ON TWITTER @_goldsky if you need my help.
              • 26903
              • 1,336 Posts
              Or the Chrome Aide Mémoire http://modxcms.com/extras/package/681
                Use MODx, or the cat gets it!
                • 32460
                • 11 Posts
                I’ve gone through the blog tutorial and I learned a lot from it. But it would be nice if the tutorial broke down the tags, to explain why what is done is done, and where to look for the documentation on what is in the tag. For example [[*content]] is pretty easy to understand. Then tags like [[~[[*id]]]] I think I can figure that out. wink

                Others like this one: [[!tolinks? &items=`[[*tags]]` &key=`tag` &target=`1`]] might as well be random monkeys banging on keyboards for all I can tell. It would be a great thing if this blog tutorial broke these tags down and pointed me to various docs that would explain how someone could find the info needed to build the right tags.
                  • 1778
                  • 659 Posts
                  Hello

                  The basis of tags are explained here http://rtfm.modx.com/display/revolution20/Tag+Syntax

                  From there you can understand that

                  [[*id]] is a variable, this can be either a Template Variable (TV), or a ResourceField (like ’content’, ’pagetitle’ etc...)

                  [[~12]] is the notation for a link pointing the resource with the ID 12

                  So if you have [[~[[*id]]]] you have the tilde ’~’ that indicates it is a link tag, and then the resource that link is pointing to... the page where you put this link ([[*id]] is the ID for the current resource)

                  Basically if a tag start with :

                  [[* --> it’s a Template Variable or a Resource Field
                  [[$ --> it’s a chunk
                  [[++ --> it’s a system setting
                  [[+ --> it’s a placeholder
                  [[ --> it’s a snippet

                  If you put an exclamation mark just after the brackets like this [[! you put the call UNcached (eg it’s processed each time the page is loaded even if the page itself is cached). In Revo (not in Evo) you can call everything cache or uncached by putting or not this exclamation mark just after the 2 opening brackets...

                  In a snippet call like [[!tolinks? &items=`[[*tags]]` &key=`tag` &target=`1`]] you should read :

                  It begins with 2 brackets and a exclamation mark, no other special distinction before the "tolinks" so it is a Snippet call. The name of the snippet is "tolinks". the exclamation mark indicate you call it uncached.
                  Then you have a question mark directly after the snippet name, the question mark (?) indicates that you want to pass some parameters to the snippet .
                  After the question mark you have a list of elements beginning with "&" a name "=" a value. This is the way to pass parameters to the snippet each parameter is delimited by the string "&nameofparam=`value of param`, ". Note the backticks aroud the value of the parameter, you separate each paramater with a comma.

                  So to further reading your snippet call translated in human reading you have :

                  I call uncached a snippet called "tolinks", where the parameter &items has the value of a TV called tags, where the &key
                  is "tags" and where the &target is "1".
                  If you read the doc for this snippet you’ll have a description of each of the parameters and how to set them


                  Hope I was clear in my explanations, and this is of use for you...
                  Cheers
                    • 28554
                    • 201 Posts
                    Quote from: anso at Oct 07, 2010, 12:36 PM

                    Hello

                    The basis of tags are explained here http://rtfm.modx.com/display/revolution20/Tag+Syntax

                    From there you can understand that...



                    Thanks for the explanation, but I’m clear with the syntax and have finished about 10-20 sites with MODx so far, that’s not the issue. The issue is that I would like to be able to access all the available vars such as [[*pagetitle]] and [[*introtext]] in a clear list, so that I know whether or not there’s underscores in it etc.

                    About the cheatsheet: where can I find it, and is it updated for Revo yet?

                    The fact that I can’t find it may be a sign that it’s not in the right place (maybe refer to it in the "Tag Syntax" part of the documentation?)
                      • 1778
                      • 659 Posts
                      Hello

                      @Steven, I agree it’s not easy to find its way through the docs...

                      But at this time, and if it can help you, (and again I agree, this info should be easily findable in the doc) you can find ALL the resource fields available (ie: all the [[*pagetitle]] [[*publishedon]] etc...) by looking at the DB in the table "modx_site_content", each field is a field resource and can be called by its name (the field name) ie :[[*menutitle]]
                      Cheers

                      BTW you can find also a list of available resource fields in rtfm : http://rtfm.modx.com/display/revolution20/Resources#Resources-ResourceFields

                      And my previous post was an answer to WillyP wink