We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29902
    • 72 Posts
    MODX Revo input/output in snippets

    Consider this:

    [[somesnippetname? &lorem=`[[*content]]`]]


    How big can the [[*content]] be before the $lorem variable stops getting it all inside the snippet?

    Is there a limit on how many chars there can be in a variable sendt into a snippet?

    Is there a way to increase this limit?

      ...I believed it was Friday...
      • 38850
      • 110 Posts
      I can't imagine there is a limit at all, save that of PHP/server's own memory limits. This could be up to 128MB or more.

      If you ever DID run in to a limit, you would not pass the content this way anyway, but rather, pass the [[*id]] and then inside the "somesnippetname" you would just load the resource object and read the content from the snippet itself, rather than passing it.

      In fact, if you have Revo 2.3.2 (maybe other versions too) you can go to Manage->Reports->System Info and find the "memory_limit" variable.

      Basically, if 128MB were your server's and PHP's memory limit, you could fit the Bible in there almost 9 times. So I wouldn't worry too much on that memory limit for normal page content.

      Another way to look at it is this. If your web page were even CLOSE to this memory limit, nobody would EVER want to load the page since they would have to wait for 10s of megabytes to download. The only way you'd reach these limits is perhaps trying to output entire database queries in the millions of rows as a single text stream, or storing binary data like large files, etc etc.
        • 9207 ☆ A M B ☆
        • 2,475 Posts
        Be careful with that Snippet: if you put it in a page's content, you can get a loop condition. The content is passed to the snippet which in turn outputs the content, and it could easily go down the wormhole and blow PHP's memory. If you're encountering any "limits" with passing variables, I would first verify that you're not in a loop-scenario (i.e. do not put a snippet like that inside the content block, do not put a snippet that takes pagetitle as an input in the pagetitle block, etc).