We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 31227
    • 198 Posts
    I have made a site which utilizes a flash header. I would like now to create an html header for those who want to browse the site without flash. How can I achieve that using 1 template? I can ofcourse duplicate all of my content and edit the template for each one but that would be a nightmare. Any tips?

    Thanks!
      Pure MODx sites
      Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Use a snippet or a TV to load either the Flash container or the non-Flash container, put the snippet call where you would normally put the container.
        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
        • 31227
        • 198 Posts
        could you please give a bit more detail since I have never done this before. Also how could I call the flash or the html page?
          Pure MODx sites
          Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          It’s the same page, using the same template.

          You would need to make a snippet that determines which the user wants to see, the flash or the plain. How are you determining this?
          // snippet LoadHeader - determine which header to load into the template
          if(...condition to show Flash...) {
            $output = '
          ... your html code to display the Flash object...
            ';
          } else {
            $output = '
          ... your html code to display static header...
            ';
          }
          return $output;
          


          Then in your template you would have something like this:
          <body>
          <div id="header">
          [!LoadHeader!]
          </div>
          
            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
            • 31227
            • 198 Posts
            huh sorry.... a bit more detail:p what is the condition for calling flash? also, how will i call the choice? how will the user be abliged to choose flash/static?
            I get the part in creating the snippet bt what is the condition?
              Pure MODx sites
              Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Actually, you could get clever and make two chunks, one for the Flash named FlashChunk, and one for the static header named StaticChunk. Then your code would look like this:
              // snippet LoadHeader - determine which header to load into the template
              $chunk = (...condition to show Flash...) ? 'FlashChunk' : 'StaticChunk';
              return $modx->getChunk($chunk);
              

              Then if you want to make changes, you can more easily edit the chunk. Besides, the code is prettier wink
                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
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                Quote from: Vait at Oct 28, 2006, 04:13 AM

                I would like now to create an html header for those who want to browse the site without flash.
                How do you intend to give them this option in the first place?
                  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
                  • 31227
                  • 198 Posts
                  I was planing to give the users a choice at the front page for flash and then maybe an html link in the site. Whats the condition to use? Thats what I dont undertand? Btw thats what I wanted to do, 2 chunks, one static & one flash... a tiny bit more detail plz? maybe you can gide me thru it if its not to hard?
                  Thanks!
                    Pure MODx sites
                    Viriko.ru & Viriko.com - Multilingual and running on 1 MODx
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    Well, the only thing I can think of is to set a cookie... maybe somebody else who uses Flash would have a better idea. I don’t like it, and have never used it (except for a neat Flash majohng game I keep in my local webspace!)
                      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
                      • 31227
                      • 198 Posts
                      maybe a way to load up the header as letsay welcome.html?header=flash
                        Pure MODx sites
                        Viriko.ru & Viriko.com - Multilingual and running on 1 MODx