We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 1008
    • 19 Posts
    Is there is a way to link to templates from outside of the modx admin panel. Maybe linking with something like an includes statement. The inability to use tabs in the modx admin interface really slows down my productivity as far as developing inside modx. Copying and pasting from an editor every time I make a change is tedious also.
      • 22840
      • 1,572 Posts
      This Firefox plug in is great if you use Firefox

      http://modxcms.com/forums/index.php/topic,39090.msg235824.html#msg235824
        • 15175
        • 116 Posts
        If you want to use an external html file as a template you can create a snippet with the necessary include statement, and then put the snippet call in a MODX template.

        I haven’t been using MODx for too long, so there may another way.
          • 5340
          • 1,624 Posts
          My templates look like

          [[includeTemplate? &tpl=`business/awards-list.html`]]


          Because I could not find the original post I will post the snippet code here
          <?php
          # Snippet to include template files from file system
          # USAGE: [[includeTemplate? &tpl=`mytemplate/template.html`]]
          
          if ( !isset($tpl) || $tpl== "" ) return "Missing Template file!";
          
          $tpl = $base_path .'assets/templates/'.$tpl;
          ob_start();
          include($tpl);
          return ob_get_clean();
          ?>
          

            • 1008
            • 19 Posts
            Quote from: cipa at Sep 18, 2009, 04:39 PM

            My templates look like

            [[includeTemplate? &tpl=`business/awards-list.html`]]


            Because I could not find the original post I will post the snippet code here
            <?php
            # Snippet to include template files from file system
            # USAGE: [[includeTemplate? &tpl=`mytemplate/template.html`]]
            
            if ( !isset($tpl) || $tpl== "" ) return "Missing Template file!";
            
            $tpl = $base_path .'assets/templates/'.$tpl;
            ob_start();
            include($tpl);
            return ob_get_clean();
            ?>
            



            What does this mean for using tv’s or chunks in your template?
              • 5340
              • 1,624 Posts
              Here is a an example of a template.html file
              [[includeTemplate? &tpl=`site/head.html`]]
              
              <body class="home">
              
              
              <div id="homeW">
              <div id="homeLeft">
              
              	<div class="featured separator"><span>Featured Project:</span> [[GetField? &docid=`36` &field=`pagetitle`]]</div>
              	<div class="featuredDesc separator">[[GetField? &docid=`36` &field=`content`]]</div>
                  
                  <div id="homeFpNav">
                      <div id="extCtrlCarousel">
                          [[Wayfinder? &startId=`36` &outerTpl=`fpExtCtrlOuterTpl` &rowTpl=`fpExtNavRowTpl` &level=`1`]]
                      </div>
                      <div class="linkTo"><a href="[~[[GetField? &docid=`36` &field=`linkTo`]]~]">View Project »</a></div>
                  </div>
                  
                  
                  <div id="fpContentProjects">
              		<div class="fpPreviousPiece"></div>
              		<div id="homeCarousel">
              			<ul>
              				[[Ditto? &tpl=`fpItems` &parents=`36`]]
              			</ul>
              		</div>
              		<div class="fpNextPiece"></div>
              	</div>	
              	
              </div>
              <div id="homeRightW">
              	<div id="homeRight">
              		[*content*]
              	</div>
              </div>
              </div>
              
              <div id="menuWrapper">
              	<div id="menu">
              		[[Wayfinder? &startId=`0` &level=`1` &rowTpl=`mainMenuRowTpl` &titleOfLinks=`alias`]]
              	</div>
              </div>
              
              </body>
              </html>
              

                • 4385
                • 372 Posts
                MODxFS lets Unix users with FUSE mount MODx databases as filesystems. This means you can directly edit Chunks, Pages, Snippets, and Templates with your preferred HTML/PHP editor.

                http://modxcms.com/extras/package/?package=292

                Unfortunately the link is dead and I don’t think I could install on my shared hosting server.
                  DropboxUploader -- Upload files to a Dropbox account.
                  DIG -- Dynamic Image Generator
                  gus -- Google URL Shortener
                  makeQR -- Uses google chart api to make QR codes.
                  MODxTweeter -- Update your twitter status on publish.
                  • 9757
                  • 82 Posts
                  Thnx for that snippet. It’s really useful.

                  WARNING FOR USERS:
                  To avoid surprises remember to clean your site cache after modifying your template smiley
                    • 20413
                    • 2,877 Posts
                    There is this hack --> http://modxcms.com/extras/package/73

                    Haven’t had the need for it yet... smiley
                      @hawproductions | http://mrhaw.com/

                      Infograph: MODX Advanced Install in 7 steps:
                      http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                      Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                      http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                      • 31075
                      • 8 Posts
                      This works. However, I wasn’t naming my snippet correctly (discovered that while pouring over this post: http://modxcms.com/forums/index.php?topic=42928.0).

                      One of my MAJOR complaints about Modx so far is that this functionality isn’t a part of the default system. I just don’t understand why you would have to go through all this just to be able to edit a file in your editor of choice. However, that said, every time I start to consider the other options (EE being the only one I’ve found that seems to compare), I think about the modx team and community. The modx team (especially rthrash) are super professional and nice (even when speaking of other CMS systems) in every post I’ve read. Modx has, in my opinion, a lot of shortcomings, but it’s a lot easier to stick with it when you genuinely like and trust the people developing it.