We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 506
    • 20 Posts
    Does anyone have any recommendations as to the best/most efficient way to display a different flash header movie on multiple pages using the same template? I am trying to avoid duplicating my main site template due to needing a different header movie on each section page.

    Some options I am considering are:

    • PHP if/then statements in main template? (I know how to do this, but I am exploring the capabilities of MODx and trying to learn more about the options provided by it’s beautiful framework)
    • Chunks?
    • Is this something better suited for a TV (Template Variable) by definition it seems so. But after reviewing the documentation on TVs it appears they are only for user selected options such as a style switcher or etc...
    • Placeholders? (I am thinking least likely of all options).

    If any MODx gurus out there don’t mind, I really would appreciate the help!


    Thanks,

    ADMIX
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      A TV would be perfect for this. You can use TVs for just about any kind of page-customized content; there are a lot of threads here about using them for selects and complicated stuff because using them for simpler things doesn’t stir up much excitement.

        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
        • 4310
        • 2,310 Posts
        There are several ways to achieve this.
        You may now or later want some pages to have a standard or default swf
        A simple but reasonably versatile method would be to :
        Create a TV [*FlashHeader*]
        Give it a default value of {{CustomFlash}}
        Place [*FlashHeader*] in your template
        Assign it to your template
        Create a chunk {{CustomFlash}}
        For the content use your embed/object code as normal but replace the swf file name with [*alias*]
        e.g.
        <param name="movie" value="assets/templates/default/images/[*alias*].swf" />

        Create another chunk {{DefaultFlash}}
        For the content use your embed/object code as normal referring to a default swf file
        Tested with images, but not flash!
        David
          • 506
          • 20 Posts
          Thanks to both of you (bunk58 & sotwell) for the insightful responses.

          bunk58...
          Sounds like your approach just may work for my needs.

          In case you are wondering exactly how I intend to use the variable graphic...

          The site I am building is for a construction co. and has 5 main site sections. Each of them use the exact same page template, the only difference is the content column, sidebar info and the issue of topic... a different flash header.

          Using an alias name for the swf file will be no problem since it will be semantically correct to vary the name anyways, ie... about.swf, communities.swf, financing.swf, etc...

          The only problem I am thinking could possibly be an issue is, what if I (either now or in the future) want a second image variable to be inserted into the same template? It doesn’t seem like I would then be able to use multiple files using [*alias*]. Am I wrong here?

          It’s late now and I’m feelin a little woozzy here. (3:30am) So I’m kickin it to bed and will attempt this when I wake up. I’ll post another reply afterward and let you know how it goes.


          Thanks Bro for the help!

          ADMIX
            • 4310
            • 2,310 Posts
            admix,
            For a second image/flash variable, a quick cheat would be to make it
            [*alias*]1.swf
            or something similar.
            That’s just off the top of my head, as most things are these days.
            Hope you slept well!
            David

              • 506
              • 20 Posts
              OK bunk58 and to anyone who hasn’t yet found their way with. you’ve got to check this out!! I found the perfect end-all solution for displaying dynamic content anywhere inside a template; outside the [*#content*] chunk. It is called "Creating TV-Based Chunks" and I found the documentation in the How-To section of the MODx Wiki. Here is the URL: http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks

              That document changed my life bro and opened some massive doors of opportunity for MODx site development work I do for my clients.

              I wonder though why the MODx developers did not include these Snippets in the Installer Options? Seems everyone could use these for some reason or another.
              You willl have to follow the URL I provided and create these two snippets to get it to work:
              Get Chunks Snippet
              Chunk List Parser

              Mad Props to:
              * Original Author - Shaun
              * Formatting, wording - Sirlancelot

              Damn, I love MODx, it is so powerful, it’s freaky!
                • 25663 MODX Staff
                • 12,272 Posts
                That is a very cool technique indeed, but it’s a bit on the advanced side of things and not necessarily appropriate for every site. If we’re able to get vertical distributions done in the future I could see this as definite fodder for inclusion.
                  Ryan Thrash, MODX Co-Founder
                  Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                  • 506
                  • 20 Posts
                  rthrash or anyone else,

                  Do you have an idea how to add sort ordering to this concept http://wiki.modxcms.com/index.php/Create_TV-Based_Chunks? It would be great if I we could add a text input (for sort order) to each chunk pulled from the getChunks snippet. That way when I activate a given chunk available to a specific template I can also input a sort order value unique to each page I am wanting to display the chunk/s on.

                  Any ideas?


                  Thanks in advance,

                  ADMIX