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

    I'm completely new to MODX so forgive me if this is a completely newbee question.

    Is it possible to dynamically include a template in another template?

    For instance, could I include a snippet in my template, and pass it a parameter (based on the visitor's user agent string or a cookie or whatever) and then have the snippet load a different template based on the value of that parameter? Is this possible?

    Thanks in advance for you help...

    Simbro
    • Run a search for MODX template switch, google. There's some old threads using a plugin that did it but Susan found that the page couldn't be cached if switched.

      http://forums.modx.com/index.php?topic=63620.msg360106;topicseen
      http://forums.modx.com/index.php/topic,1079.0.html

      The question begs to be asked, under what circumstance do you need the template switched? Is this for mobile? If so, then CSS and media queries are likely the best answer, with plenty of tools to do so in the numerous responsive frameworks available now (Bootstrap, Foundation, etc.).

      Does that help?
        Frogabog- MODX Websites in Portland Oregon
        "Do yourself a favor and get a copy of "MODX - The Official Guide" by Bob Ray. Read it.
        Having server issues? These guys have MODX Hosting perfected - SkyToaster