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

    I am following along with this tutorial: http://net.tutsplus.com/tutorials/other/working-with-a-content-management-framework-modx/

    So I create a template and put some HTML code in the resources field. Then, when I go to Site/New Document, I select the template I want to base this new document off of.

    I get the warning "Are you sure you want to change this template?"

    And I select yes. But the resource content window where all the HTML code should be, is completely empty.

    Isn’t the code I have entered in the template Resource Content supposed to show up in this new document?
      • 7914
      • 137 Posts
      You will need to place the html you have created into a template.

      I am speaking about MODx Revolution here, but Evolution will be quite similar.

      The Resource (document) you create will need to use one of the templates that you have created.

      If you notice there is a variable that looks like this:
      [[*content]]
      

      This is where the actual page content (text) will fill your site within your template.

      The "Resource Content" refers to the actual content on your site. This is where an admin would type any/all content, upload images etc.

      You will not see any markup (html) in that area unless you desire to put that in there.

      A sammple template might look something like this:
      <html>
      <head>
      </head>
      <body>
      <div id="wrapper">
      <h1>[[*longtitle]]</h1>
      [[*content]]
      </div>
      </body>
      </html>
      


      So when you choose this template - Any/all content that you type in the "Resource Content" area will show up right after the <h1> tags.

      Hope this helps!
        • 25148
        • 5 Posts
        Hi dowhatnow, yes I do desire to see the markup in my template. I am the admin, I’m coming at this from a CSS/HTML perspective. I’m trying to see how closely I can match the experience of creating a site in a text editor (no wysiwyg) in a CMS program. So seeing the code as I design the site is the main thing for me.

        I need to SEE the HTML code in my template, just like I would see a regular CSS/HTML template I create in a text editor.

        Is there something I’m missing where I can make it so that my templates show me the code?
          • 7914
          • 137 Posts
          Well, your template is the markup.

          A typical workflow (for me) is to develop the page as if I was building a static page. Build out the html/css/javascrpt etc in your editor of choice.
          I will use lorem ipsum to simulate content even. When I have my site looking the way I want, I replace my main content area of my mockup with this tag:
          [[*content]]
          

          And my <h1> mockup with this tag:
          <h1>[[*longtitle]]<h1>
          

          These are 2 modx tags that will be used in nearly every template so I like to put them in right away so I can test my page.

          Now go into modx, and click the "Elements" tab. From there, you will want to create a new template, and paste in all of the html that you have just built. Be sure to give your template a name, then save it.

          Then click on the "Resources" tab, and create a new resource. You could also click on the existing resource - the one with the (1) next to it.
          Let’s say you clicked on the existing resource. When you click on it, it will take you to the "edit resource" view.

          From there choose your newly created template. Be sure to click "Save" on the upper right corner. Now the page you are looking at is using the template (the html) that you built. You will not see any of the markup in the "Resource Content" area. That area is for your content. By content I mean the words/pictures that you want on your site. Type anything in there, this is just a test page. You will also need to give your page a title.

          Once you have all of that information click "Save" once again, and then click "Preview". You should the text that you wrote in the "Content Resource" field. If you view the page source, you will see that the page is using your template.