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

    It seems that a page with the (empty) template will output the content. I like this but I want to make sure it’s a feature and not a bug.

    Thank You
      • 22295
      • 153 Posts
      yes, empty template would just outputs the content.
      otherwise, you’d need to have your own empty template (with [[*content]]) for that.. and the built-in empty template would have been quite meaningless..
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        The parser gets the document from the database, and checks its template. If it has no template, then the parser just pretends that it’s using a template with only the [*content*] tags. If it does have a template, then the parser goes to the database to get the template and uses that.
        if (!$this->documentObject['template'])
            $this->documentContent= "[*content*]"; // use blank template
        ...
         
          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
          • 5340
          • 1,624 Posts
          So it’s a feature smiley
          I use it in Revo to generate the header, menu and footer for the SMF install so I was just worried that it might change in the future.

          Thank you
            • 25663 MODX Staff
            • 12,272 Posts
            This is a changing behavior from Evo ... I like it better this way as well. I’m not sure how to address it going forward but we should put a stake in the ground and make a policy. It does however bring to mind the thought of having an option on "blank" template pages to have them act as snippets and parse the content of [[*content]]. Or maybe having a "Processor" resource type which can be used for Ajax calls, etc. (What we currently do now by just including a snippet on a blank template for Ajax calls, etc.) Hmmm.... Thoughts?
              Ryan Thrash, MODX Co-Founder
              Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
              • 5340
              • 1,624 Posts
              I’m ok with (empty).

              I don’t currently see a reason for a Processor resource type. If you don’t like empty you can always create your own template called Processor, Ajax etc.

              For ajax websites I usually set up a folder named ajax and I keep all my resources in there. Another way to do it is to prefix your documents with ajax so the generated alias is something like ajax-bla-bla.


                • 22295
                • 153 Posts
                Quote from: rthrash at Apr 24, 2010, 05:43 AM

                Or maybe having a "Processor" resource type which can be used for Ajax calls, etc. (What we currently do now by just including a snippet on a blank template for Ajax calls, etc.) Hmmm.... Thoughts?

                You can make a static resource pointing at your connector that would actually become a "Processor resource type" as you suggested.

                You can also not make any resource and just ajax call your processors (via a connector) directly.
                This means you’re losing changeable friendly-url (would you really need it on a connector?) and ACL control via manager. but normally you’d anyway check permissions in your connector/processor (hasPermission).



                jquery example (a processor that sends an activation to a user)
                (the important things here are:
                a. connector.php -or- static resource url
                b. action path
                c. ,json
                all the rest is up to your processor

                $.post('/assets/components/forces/connector.php'
                	,{	action: 'web/services/sendActivation'
                		,memberId: memberId
                		,ctx: 'web'
                	}
                	,function(r){
                		if (r.success == false) { alert(r.message); }
                		else { alert("ok");	}
                	}
                	,'json'
                );
                  • 22303 MODX Staff
                  • 10,725 Posts
                  Quote from: rthrash at Apr 24, 2010, 05:43 AM

                  This is a changing behavior from Evo ... I like it better this way as well. I’m not sure how to address it going forward but we should put a stake in the ground and make a policy. It does however bring to mind the thought of having an option on "blank" template pages to have them act as snippets and parse the content of [[*content]]. Or maybe having a "Processor" resource type which can be used for Ajax calls, etc. (What we currently do now by just including a snippet on a blank template for Ajax calls, etc.) Hmmm.... Thoughts?
                  I think you are mistaken; Evo and Revo (should) behave exactly the same in this regards...AFAIK this is totally a non-issue. If Evo no longer parses the content when using the built-in "empty" template, then that is a bug.
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    It parses the content on both the default "empty" template and a blank template.
                      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
                      • 22303 MODX Staff
                      • 10,725 Posts
                      Quote from: sottwell at Apr 26, 2010, 10:39 AM

                      It parses the content on both the default "empty" template and a blank template.
                      IMO, a "blank" template, void of any content is an error; it should not be allowed to exist in Evo or Revo.