We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51584
    • 5 Posts
    Hi,

    I found MODx through searching some CMS systems on the web to find an alternative system to Contao, which I used so far for my websites. MODx made a great expression and so I signed up for a Cloud account just to start right away and learn this CMS from scratch.

    After spending some time I'm now at a point where I really don't know what to do with MODx. All the stuff with the template variables, chunks, snippets, whatever, gets more complicated the deeper I try to get involved. I reached now somehow a certain frustration level since I really don't have any kind of idea how to build up a web page from scratch. So much tags can be used, but they're so different.

    To me it seems that it is really for very advanced users/designers with developer skills. Getting involved as new user isn't easy, from my point of view.

    I.e. I miss some kind of workflow on how to get startet. I watched the intro videos (tutorials), tried to follow videos on Youtube channels, but this all did not give me any kind of clue, sorry.

    Seems that there's really lot of trial and fail in front of me ... and lots of frustration.

    Regards, Thomas
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      That's a problem... MODX is so flexible that it's hard to pin down exactly where to start. What do you have in mind to do? What background do you have?

      Usually the best place to start is to get a single page working. I always start with a Not Found resource, and assign its ID to the "error_page" setting in System Settings. This Not Found page can be built to have any number of common features, such as a site map (using a menu snippet like Wayfinder or pdoMenu) and a search form (using a search snippet, like SimpleSearch). It's a good way to start working with all of the MODX parts.

      I'm no designer, and I'm cheap and a bit lazy, so I usually go looking in Google for free examples of not-found pages to adapt. Contact forms the same, as well as a "coming soon" or "under construction" page to use when the site is offline - like this one which I am rather pleased with http://modxcookbook.com/coming-soon.html

      I also work the same way for entire site themes. Right now I'm working my way through half a dozen of the more basic Bootstrap themes, porting them to MODX. Again, taking one of the more complex Bootstrap (or any other free web theme) sites and adapting it to MODX one feature at a time is an excellent way to learn all the different bits to MODX.

      Another good way to start would be to install a full working-site package, such as the Flatso blogging platform package. https://github.com/modxcms/flatso/blob/master/README.md

        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 17403 ☆ A M B ☆
        • 183 Posts
        That's what exactly what I feel when I try MODX for the first time... Hope this help to dig into MODX.

        #1 Template

        • Go to template: Element > Template
        • Click on available template, usually on the fresh install there will be one template: BaseTemplate with TemplateID=1
        • In that template, you can find some tags [[++site_name]] [[*pagetitle]], etc.
        • Try to duplicate that BaseTemplate to whatever name you want (for example "TestTemplate"). Then save.

        #2 Resource

        • Back to Resources...
        • Try to create a new resource. And give it pagetitle (for example "Test Page"), and copy paste some html-text into content/textarea. Choose the template "TestTemplate" you just created above. Then save.
        • After saving "Test Page", click on the VIEW button on the top right.
        • You will be redirected to frontpage of that page. Try to view the source of that page, and you will see that the "TestTemplate" and the new "Test Page" were similar, except some tags like [[*pagetitle]] [[*content]] has been replaced.


        Cheers
          zaenal.lokamaya
          • 13226
          • 953 Posts
          I have been using MODX for about 10 years now - I am NOT a DEVELOPER, I am a front-end designer / developer

          If you want to build a website using MODX, either Evo or Revo you will have a steep learning curve - but that's the same with any new system

          There are tons of tutorials out there about creating templates, using chunks, implementing snippets etc.

          An example:

          I am an Evo fan and have tried to keep away from Revo since it was released a few years back.

          I recently took the plunge and started using it - I spent pretty much the whole of December (2015) learning how to use Revo and now I know how to create a template, create a new page and implement snippets, chunks etc.

          It's just a matter of time and a lot of reading in the forums and in other places

          As with everything else where you don't have someone to teach you direct: Trial & Error => Learn from your mistakes
            • 17403 ☆ A M B ☆
            • 183 Posts
            I think Template and Resource both the very basic of MODx. Thats two will give us a complete website.

            Then you can try to change/edit the template and play around with it. As for the tags mentioned above, its known as MODx Template Tags. And here the list of commonly used template tags https://rtfm.modx.com/revolution/2.x/making-sites-with-modx/commonly-used-template-tags.

            Here are some examples:

            • [[*fieldname]] -> will be replaced by fieldname of resource. For example [[*pagetitle]] will be replaced by "Test Page"
            • [[++system_setting]] -> will be replace by modx setting.
            • [[~ResourceID]] -> will become URL. For example <a href="[[~1]]">Home</a> become <a href="index.php?id=1">Home</a>


            Cheers
              zaenal.lokamaya
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              http://sottwell.com/articles/90-minutes/

              Only mostly finished, one of these days I have to work on it some more.

              I'd also seriously recommend BobRay's book, generally considered the authoritative source for all things MODX. His website and blog are wonderful sources too; I refer to several of his articles frequently. http://bobsguides.com/modx-the-official-guide-digital-edition.html
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org
                • 30585
                • 833 Posts
                Thomas, sorry to see that you're having some trouble getting started with MODX. I can assure you that MODX isn't just for the experienced developers. In fact, MODX is designer-friendly. If you can build an HTML/CSS website, you surely can use MODX! Unlike many other Content Management Systems, MODX never dictates how to write your HTML or even name your files. That decision is yours to make.

                What's a Template?

                Let's consider this scaled-down blog post example from Bootstrap:
                // Static HTML Template
                <!DOCTYPE html>
                <html lang="en">
                  <head>
                    <meta charset="utf-8">
                    <meta http-equiv="X-UA-Compatible" content="IE=edge">
                    <meta name="viewport" content="width=device-width, initial-scale=1">
                    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
                    <meta name="description" content="The official example template of creating a blog with Bootstrap.">
                    <meta name="author" content="">
                
                    <title>Blog Template for Bootstrap</title>
                    <!-- Bootstrap core CSS -->
                    <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
                    <link href="http://getbootstrap.com/examples/blog/blog.css" rel="stylesheet">
                
                    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
                    <!--[if lt IE 9]>
                      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
                      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
                    <![endif]-->
                  </head>
                
                  <body>
                
                    <div class="blog-masthead">
                      <div class="container">
                        <nav class="blog-nav">
                          <a class="blog-nav-item active" href="#">Home</a>
                          <a class="blog-nav-item" href="#">New features</a>
                          <a class="blog-nav-item" href="#">Press</a>
                          <a class="blog-nav-item" href="#">New hires</a>
                          <a class="blog-nav-item" href="#">About</a>
                        </nav>
                      </div>
                    </div>
                
                    <div class="container">
                
                      <div class="blog-header">
                        <h1 class="blog-title">The Bootstrap Blog</h1>
                        <p class="lead blog-description">The official example template of creating a blog with Bootstrap.</p>
                      </div>
                
                      <div class="row">
                
                        <div class="col-sm-8 blog-main">
                
                          <div class="blog-post">
                            <h2 class="blog-post-title">Sample blog post</h2>
                            <p class="blog-post-meta">January 1, 2014 by <a href="#">Mark</a></p>
                
                            <p>This blog post shows a few different types of content that's supported and styled with Bootstrap. Basic typography, images, and code are all supported.</p>
                            <hr>
                            <p>Cum sociis natoque penatibus et magnis <a href="#">dis parturient montes</a>, nascetur ridiculus mus. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. Sed posuere consectetur est at lobortis. Cras mattis consectetur purus sit amet fermentum.</p>
                            <blockquote>
                              <p>Curabitur blandit tempus porttitor. <strong>Nullam quis risus eget urna mollis</strong> ornare vel eu leo. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>
                            </blockquote>
                            <p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p>
                            <h2>Heading</h2>
                            <p>Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Morbi leo risus, porta ac consectetur ac, vestibulum at eros.</p>
                            <h3>Sub-heading</h3>
                            <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
                            <pre><code>Example code block</code></pre>
                            <p>Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa.</p>
                            <h3>Sub-heading</h3>
                            <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Aenean lacinia bibendum nulla sed consectetur. Etiam porta sem malesuada magna mollis euismod. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus.</p>
                            <ul>
                              <li>Praesent commodo cursus magna, vel scelerisque nisl consectetur et.</li>
                              <li>Donec id elit non mi porta gravida at eget metus.</li>
                              <li>Nulla vitae elit libero, a pharetra augue.</li>
                            </ul>
                            <p>Donec ullamcorper nulla non metus auctor fringilla. Nulla vitae elit libero, a pharetra augue.</p>
                            <ol>
                              <li>Vestibulum id ligula porta felis euismod semper.</li>
                              <li>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</li>
                              <li>Maecenas sed diam eget risus varius blandit sit amet non magna.</li>
                            </ol>
                            <p>Cras mattis consectetur purus sit amet fermentum. Sed posuere consectetur est at lobortis.</p>
                          </div><!-- /.blog-post -->
                        </div><!-- /.blog-main -->
                
                        <div class="col-sm-3 col-sm-offset-1 blog-sidebar">
                          <div class="sidebar-module sidebar-module-inset">
                            <h4>About</h4>
                            <p>Etiam porta <em>sem malesuada magna</em> mollis euismod. Cras mattis consectetur purus sit amet fermentum. Aenean lacinia bibendum nulla sed consectetur.</p>
                          </div>
                          <div class="sidebar-module">
                            <h4>Archives</h4>
                            <ol class="list-unstyled">
                              <li><a href="#">March 2014</a></li>
                              <li><a href="#">February 2014</a></li>
                              <li><a href="#">January 2014</a></li>
                              <li><a href="#">December 2013</a></li>
                              <li><a href="#">November 2013</a></li>
                              <li><a href="#">October 2013</a></li>
                              <li><a href="#">September 2013</a></li>
                              <li><a href="#">August 2013</a></li>
                              <li><a href="#">July 2013</a></li>
                              <li><a href="#">June 2013</a></li>
                              <li><a href="#">May 2013</a></li>
                              <li><a href="#">April 2013</a></li>
                            </ol>
                          </div>
                          <div class="sidebar-module">
                            <h4>Elsewhere</h4>
                            <ol class="list-unstyled">
                              <li><a href="#">GitHub</a></li>
                              <li><a href="#">Twitter</a></li>
                              <li><a href="#">Facebook</a></li>
                            </ol>
                          </div>
                        </div><!-- /.blog-sidebar -->
                
                      </div><!-- /.row -->
                
                    </div><!-- /.container -->
                
                    <footer class="blog-footer">
                      <p>Blog template built for <a href="http://getbootstrap.com">Bootstrap</a> by <a href="https://twitter.com/mdo">@mdo</a>.</p>
                      <p>
                        <a href="#">Back to top</a>
                      </p>
                    </footer>
                
                
                    <!-- Bootstrap core JavaScript
                    ================================================== -->
                    <!-- Placed at the end of the document so the pages load faster -->
                    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>    
                    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
                  </body>
                </html>
                
                


                The HTML markup above is what you'd put in your MODX Template. Chunks and Template Variables help you organize your Template. Typically Chunks are used for the parts of your Template that are common to all pages that use it. Template Variables, are basically custom fields. You'd use them to store data that doesn't structurely belong in regular resource fields.

                Now let's see how easy it is to turn our Bootstrap blog post template into a MODX template:

                // Dynamic MODX Template
                <!DOCTYPE html>
                <html lang="en">
                  <head>
                    [[$PageHead]]
                  </head>
                
                  <body>
                
                    [[$PageNavigation]]
                
                    <div class="container">
                      
                      <div class="blog-header">
                        <h1 class="blog-title">[[*pagetitle]]</h1>
                        <p class="lead blog-description">[[*description]]</p>
                      </div>
                
                      <div class="row">
                
                        <div class="col-sm-8 blog-main">
                          <img src="[[*FeaturedImage]]" width="640" class="img-responsive" alt="[[*FeaturedImageCaption]]">
                          <hr>
                          <div class="blog-post">
                            <h2 class="blog-post-title">[[*longtitle]]</h2>
                            <p class="blog-post-meta">[[*publishedon:strtotime:date=`%B %e, %Y`]] by <a href="[[~10]]">[[*createdby:userinfo=`firstname`]]</a></p>
                
                            [[*content]]
                            
                          </div><!-- /.blog-post -->
                        </div><!-- /.blog-main -->
                
                        <div class="col-sm-3 col-sm-offset-1 blog-sidebar">
                          [[$BlogDescription]]
                          [[$BlogArchives]]
                          
                          [[$Blogroll]]
                    
                        </div><!-- /.blog-sidebar -->
                
                      </div><!-- /.row -->
                
                    </div><!-- /.container -->
                
                    [[$Footer]]
                
                    [[$PageScripts]]
                  </body>
                </html>
                


                Voilà!

                We went from a static HTML template to a dynamic template without breaking a sweat. We didn't use any Snippets (PHP), hacks or plugins. Just our HTML, using MODX tags.

                Let's dissect our MODX template:

                [[$PageHead]] => This is the chunk that contains the page's metadata. In it, you'll find this:
                <meta charset="utf-8">
                <meta http-equiv="X-UA-Compatible" content="IE=edge">
                <meta name="viewport" content="width=device-width, initial-scale=1">
                <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
                <meta name="description" content="The official example template of creating a blog with Bootstrap.">
                <meta name="author" content="">
                
                <title>[[*pagetitle]]</title>
                <!-- Bootstrap core CSS -->
                <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
                <link href="http://getbootstrap.com/examples/blog/blog.css" rel="stylesheet">
                
                <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
                <!--[if lt IE 9]>
                  <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
                  <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
                <![endif]-->
                

                Looks familiar? It surely does.

                [[*pagetitle]] => is the page/post title, which will be replaced by Blog Template for Bootstrap

                [[$PageNavigation]] => This chunk contains the main navigation block. In it, you'll find this:
                <div class="blog-masthead">
                  <div class="container">
                    <nav class="blog-nav">
                      <a class="blog-nav-item active" href="[[~1]]">Home</a>
                      <a class="blog-nav-item" href="[[~2]]">New features</a>
                      <a class="blog-nav-item" href="[[~3]]">Press</a>
                      <a class="blog-nav-item" href="[[~4]]">New hires</a>
                      <a class="blog-nav-item" href="[[5]]">About</a>
                    </nav>
                  </div>
                </div>
                


                Typically, you'd use an extra like Wayfinder to generate dynamic navigational menus, but like I said earlier, MODX is very flexible. What you choose to use (or not) is up to you. Soon enough you'll appreciate the power of extras.

                [[~2]] => This is a MODX link tag (as seen in the navigation chunk above). The number between the brackets is the id of the page (resource) you're linking to.

                [[*FeaturedImage]] => is a Template Variable. So is this: [[*FeaturedImageCaption]]. In the example above, it allows us to assign a Featured Image as well as a caption to each blog post.
                <img src="[[*FeaturedImage]]" width="640" class="img-responsive" alt="[[*FeaturedImageCaption]]">
                


                [[*content]] => is the post content (body text).

                I'll stop here as I'm sure the picture is clearer by now. This was a very basic example to show how easy it is to build a template in MODX. There are obviously more efficient (and better) ways of doing certain things, but that's beyond the scope of this post.

                Check out MODX's Quick-Start Video Series to get the full picture.
                [ed. note: treigh last edited this post 10 years, 9 months ago.]
                  A MODx Fanatic
                  • 46886
                  • 1,154 Posts
                  Just do something. Template sounds good. You just need a goal.

                  Throw a template in there and get going. Bootstrap framework is available too.

                  You will probably do it in an inefficient way, but you will learn. All the pieces *do* make sense once you see how they help you achieve...a goal.
                    • 51584
                    • 5 Posts
                    I visited some of the links you provided to me and actually it somehow gets more clear. Several examples (also thanks to treigh) helped me a bit to understand the synatx a bit better. Still somehow confusing is the work-together of template variables and templates, the concept is truly different to the CMS I used 'til today.

                    Many thanks, regards, Thomas
                      • 4172
                      • 5,888 Posts
                      Quote from: mosesontheweb at Jan 05, 2016, 07:25 AM
                      Still somehow confusing is the work-together of template variables and templates

                      Well, with template-variables, you extend Resources with additional fields.
                      You assign Template-Variables to Templates.
                      As soon, as you select a specific Template for a Resource, the Resource has this Template-Variables of that selected Template as additional fields.

                      There is also another way to extend Resources with addional fields with the ClassExtender-extra:
                      http://bobsguides.com/classextender-class.html
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!