On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • I’m loving MODx, but I’m not sure exactly where to start in modfying the ’test site’ to fit my needs and begin the transformation into the site I desire.

    Ultimately, the site I’m looking to build will look like this: http://www.savannahweb.net/alderfoods/

    That’s an HTML mockup, and now I’ve gotta’ start incorporating that look/feel into a functioning site with a quality CMS.

    Specifically, I’m a little confused when it comes to documents/variables/snippets/etc.

    All pages will have the same layout, but what appears will change depending on what ’page’ someone’s looking at.

    So if they are on Page A - I want them to get content for Page A, and the header for Page A. If they are on Page B, I want the same thing. So on and so forth.

    Unfortunately, I’m having difficulty discerning exactly how everything relates to one another.
    • Basically you can create this site with the use of the wayfinder snippet for the menu and then you have different possibilities for the header part. If it is a client site. You will do this by inserting a snippet that will allow to choose a header that you can upload.

      another method is inserting body id or class to the body tag and then add the specific Id to point to your image file.

      But i think you need to read some of the documentation in order to complete this task.
      • Basically, the way MODx works, is that the HTML layout is determined by the template. Create a new template in "Resources -> Manage Resources" and the "Template" tab.

        The content that is displayed can either be hard-coded into the template, or can be managed dynamically with MODx tags. The most central tag is the [*content*] tag. This content is taken from the "Document Content" field of a given document. Documents are stored in the database (as is the template, by the way), and can be accessed via the "Document Tree", the left frame of the Manager, which displays the documents in a virtual tree structure, based on the parent/child relationships of the documents. Every document can be a parent (container), and each document is assigned on creation with a parent (as well as a number of other fields, including its template).

        A document is requested by its id (index.php?id=xx), but using the document’s "Alias" (another field you can assign during document creation) and the "Search-Engine-Friendly URL" system along with mod_rewrite and .htacces files for Apache, this index.php?id=xx can be replaced with more friendly URLs such as "home.html" or "contact.htm" or whatever.

        Upon request, either directly or through the rewrite system, a document is obtained from the database via its ID, and its associated template is also retrieved. The template is then parsed, and all MODx tags in the template are parsed and inserted into the HTML code. The completed page is then sent on by the server.

        Menu building snippets (such as Wayfinder) scan the Document Tree according to the options given at the snippet’s call, and generate a menu accordingly. Thus the structure of your Document Tree, based on the parent/child relationships you assign to your documents as you create them, will be used to determine the structure of the menus these snippets can generate.
          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
        • Okay, now it’s making sense! Thanks Susan!

          Question: I’ve got ’documents’, but what if i want specific things, JUST on iterations those documents, and not on all pages of the template?

          in other words - on the main page of the site, we’ve got a list of BRANDS and various headers that only apply to this page.

          Is there a way to associate it with the main page, but NOT have it be in the normal "content update" textbox that you use on the Document page?

          For example - headers. Is there a way to create a variable similar to [*content*] that will pull a specific header based on which document you’re viewing, rather than having to hardcode it in the document’s content box?
          • When you edit a document you have a number of fields you can use in the page display, most are named similarly to the tagname you would use, such as [*pagetitle*] and [*longtitle*].
            <h1>[*pagetitle*]</h1>
            <h2>[*longtitle*]</h2>
            

            There are also a number of site-wide values, such as [(site_name)]. These are actually taken directly from the database field names; most of them aren’t of much value for page display, but are nice to know about anyway. I often use this in my footer:

            &copy 2007 <a href]"mailto:[(emailsender)]">[(site_name)]</a>
            


            http://modxcms.com/modx-tags.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
            • Susan, aye. I figured that one out. Is there any other way, for elements that MAY NOT be dependent on those specific entries?
              • There are several ways to do this, including using different templates for different types of pages (which is what Susan was suggesting) and setting up one or more Template Variables. I think that if you read through the MODx documentation you will see how these and other MODx basics work and will be able to choose the solution that makes the most sense to you. And perhaps the best way to understand how these things work is to give them a try.
                  "Things are not what they appear to be; nor are they otherwise." - Buddha

                  "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                  Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                • Zap - the concept of making multiple templates works fine. I was looking for a more streamlined way of doing this.

                  If I were writing a CMS from scratch, I could put in IF THEN style logic to keep the redundancy down. I guess I was looking for something similar here?

                  Where I could put logic into a TV or something that would know which page was being pulled and what not. And perhaps all this is possible, but ModX is very big and very robust, and while I COULD read through every single piece of documentation, I assumed that the purpose of the forum was to help people get to answers when they find it in the Wiki or set of documentation.

                  Susan was helpful, i’m just looking for another way to do this that would require the least amount of TV, Template, Chunk, etc. creation, and relied more on conditional logic.

                  • If I understand what you want to do correctly, you can do what you’re asking a number of ways (which is why I suggested that you take a look through the documentation, because you might very well have a "Eureka!" moment in doing so):


                    • Use different templates for different types of pages
                    • Use one or more checkbox TVs with the output scripted in the TV
                    • Use a snippet that checks the value of a TV, what folder a document is in, or some other flag to determine what to output
                    • Use the PHx class, which would give you conditional TVs that you can write directly into your templates or content
                    • Probably a half-dozen other ways...

                    This is one of the great things about MODx: There are almost always multiple ways to do something.

                    Why don’t you try one or more of these and see if you like it? If you then have specific questions about how to make something work, there are a lot of people here who will jump at the chance to help you out. When the questions are very general and covered in the basics of the documentation, however, the most efficient reply is to direct you there.
                      "Things are not what they appear to be; nor are they otherwise." - Buddha

                      "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                      Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options