We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23810
    • 17 Posts
    I’m trying to get my head around the concepts underlying the MODx framework.

    One thought I had was that "Chunks" seem to be what I understand as performing a function similar to an "Include" in PHP (http://au2.php.net/include/) or Apache http://httpd.apache.org/docs/1.3/howto/ssi.html or even the include bot in good old FrontPage 2003.

    The definition provided in MODx documentation http://modxcms.com/editor-terms.html is as follows:
    ...re-usable pieces of HTML content. You can place a Chunk in the main content area or in a template variable... Elsewhere at http://modxcms.com/adding-chunks.html chunks are described as -

    ...blocks of plain text or (X)HTML markup that is inserted directly into your page at the location you place the tags...

    So I gotta ask: is there anything special about chunks that is not available via a server side include - In short is the Chunk tag just another way of including text on a MODx site?

    In short, is -

    {{MyChunk}} - in MODx, the same thing as (say)

    include ’MyChunk’’; in a PHP file?
      The shallower you are, the more ground you cover.
      • 12652
      • 228 Posts
      Yes... and no all depends on how you use includes.

      Includes may just be regular html code, or it could be made up of php functions and actions.

      Snippets would be more comparable perhaps to a php include... bits of code that carry out some action or function and return some result.

      Chunks may be more comparable to a Dreamweaver library item... simple static html code that gets reused across, more than likely, the entire site. Of course, MODx allows you to assign different templates to different areas of the site, so this isn’t entirely true as you could have some chunks that only appear in some templates, and some that are in all templates.

      Chunks may often be used for header or footer code that stays the same throughout the site. Though others, like sottwell, will use chunks to form the basis of their templates, and then built templates out of the various chunks.

      But chunks can also contain snippets and TV’s, so the lines blur and twist a little with as much flexibility as your particular needs demand.
        | Identity Developments delivers SEO focused web design and web presence services
        - it's not about websites, it's about your identity. |
        • 23810
        • 17 Posts
        Thanks.

        It’s getting clearer and more interesting.
          The shallower you are, the more ground you cover.