We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 32241
    • 1,495 Posts
    Hi guys, can I know the way how document parsing in MODx works?

    I mean when I want to create a module, I will have a parameter that I can setup in the second tab, which it will later able to be shared with snippets and plugins. Now the question is, when I change that parameter value in module, will it affect the one on snippet and plugin? If it’s which one will be executed first?

    Another thing is, for a variables or function that create in modules, it will not be exported to snippet or plugin right? The only way to share a function is through the include files right? If I want to share variables, it has to be from the sharing parameters right? Now the question is, how about if I want to let plugin change certain variables, and it’s able to be retrieved by the snippet and module? Does it has to be declared as GLOBAL variables?

    How about sharing variables between snippets, without having to declared global variables? Same thing plugin and plugin?

    Hope I’m not asking too much question in here. The basic question is, how do I share resources variables between snippet, plugin, and module. I know the parameter sharing, but it’s a static variables, which is I want the ability have a dynamic variables to be declared.
    \
    Thanks

    Regards,
    Wendy Novianto
      Wendy Novianto
      [font=Verdana]PT DJAMOER Technology Media
      [font=Verdana]Xituz Media
    • Wendy, one way I’ve found to share variables between the various components is to have one component use the
      $modx->setPlaceholder($placeholderName, $placeholderValue)
      function and another retrieve that value via
      $modx->getPlaceholder($placeholderName)
      . You’ll have to be sure they are executed in a proper sequence, depending on if you are developing plugins or snippets (or modules).

      In the future we’ll be able to use resources as parameters of other resources, e.g.
      [[MySnippet?param=`[[MyParamSnippet]]`&otherparams=`othervalues`]]
        • 32241
        • 1,495 Posts
        Now that explains.

        The only thing that concern me is, there will be a security issue in here, when the we accidentally have the placeholder being parsed to the document, because there is a placeholder tag with the same variables name. I know this is really2 rare, mamybe 0.0000001%, but there is still an possibility that this will happen.

        I was thinking either to set the placeholder variables to something elese when it’s done being transfered back on forth. So it’s nothing to worry about.

        As for the new system, it really amaze me... When is this thing will be implemented?

        Another thing, can we run module on the front page? So it’s like a page, but it has an alias and pageid as well. In Quickedit example, we can use plugin to tap into the system and output something to the page together with the page rendering. But how about if I want to display a front end page where web user able to configure it too. Will that be do able?

        Thanks
          Wendy Novianto
          [font=Verdana]PT DJAMOER Technology Media
          [font=Verdana]Xituz Media
        • Also, another great way to share information across resources and across pages, is to use $_SESSION variables.

          Quote from: wendy at Dec 15, 2005, 08:09 PM

          The only thing that concern me is, there will be a security issue in here, when the we accidentally have the placeholder being parsed to the document, because there is a placeholder tag with the same variables name. I know this is really2 rare, mamybe 0.0000001%, but there is still an possibility that this will happen.
          Actually this is not a possibility. Placeholders are stored in the $modx object in an associative array and will not clash with any global variables.

          Quote from: wendy at Dec 15, 2005, 08:09 PM

          As for the new system, it really amaze me... When is this thing will be implemented?
          It’s part of a major overhaul/refactoring project that is underway heading towards the 1.0 release. We don’t have specifics yet on a public release, but we will share details as we meet key milestones.

          Quote from: wendy at Dec 15, 2005, 08:09 PM

          Another thing, can we run module on the front page? So it’s like a page, but it has an alias and pageid as well. In Quickedit example, we can use plugin to tap into the system and output something to the page together with the page rendering. But how about if I want to display a front end page where web user able to configure it too. Will that be do able?
          Several initiatives of the project I am referring to will address this, though I do not yet have concrete specifics on how. wink
            • 32241
            • 1,495 Posts
            Quote from: OpenGeek at Dec 15, 2005, 08:35 PM

            Several initiatives of the project I am referring to will address this, though I do not yet have concrete specifics on how. wink

            That doesn’t sounds too good... Is this going to be implemented later? As far as I understand, you’re saying that we still need to make a workaround for it to work on the front, like using snippet to include an external file, and include those snippet in the document?

              Wendy Novianto
              [font=Verdana]PT DJAMOER Technology Media
              [font=Verdana]Xituz Media
            • Yes, you currently need a workaround. There’s no concrete timetable for the overhaul, but you can at least count on what’s out currently to work! smiley
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me