We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33657
    • 128 Posts
    so my web context would be

    www.site.com for example.

    and my CSS would be /site.css

    which would result in www.site.com/site.css

    ---

    but if i made a new context called dev and I setup a subdomain so its dev.site.com

    when I run that page /site.css now becomes

    dev.site.com/site.css


    is it possible to share the same base root? so dev.site.css having /site.css would goto www.site.com/site.css ?

    Or what would be a better way to have a Main site and a TEST site (dev) where all i have to do to publish a page is drag it from 1 context to the other. ?

    • You could use a custom setting for the desired css_url and set it to be the same for both contexts, then use [[++css_url]]
        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
        • 42562
        • 1,145 Posts
        Exactly! the value of [[++css_url]] would be absolute : www.site.com/site.css
          TinymceWrapper: Complete back/frontend content solution.
          Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
          5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
          • 33657
          • 128 Posts
          Maybe I am misunderstanding contexts. Are they not designed for what I want to do? I want to use the same master page on both, and trigger the same addons (phpthumb) on both, but it seems like phpthumb wants access to /assets/components/phpthumb and there once again is a absolute path that gets borked in multiple contexts. I understand I can hardcode all the CSS the JS and any other absolute path, but now im starting to think maybe contexts is better suited for some other section of a site like docs, or something related but not shared. If i wanted to run a dev site and a main site, and they mirror eachother would I be better suited using Gitify and or Vapor or something like that instead? or should I just have unpublished test pages and then publish when I want to make them live.

          thoughts?
            • 42562
            • 1,145 Posts
            Contexts do what you want, but you are talking multi domain here.
            You have to copy over any Extra that cannot work cross-domain, I am talking them Extras that are heavy on server-side actions, namely phpThumb.
            As for all other Extras I am sure you can explicitly declare their existing absolute paths in your new context.

            I have something sort of similar; it takes me less than a second to duplicate the assets/components and core/components folders using command line
              TinymceWrapper: Complete back/frontend content solution.
              Harden your MODX site by passwording your three main folders: core, manager, connectors and renaming your assets (thank me later!)
              5 ways to sniff / hack your own sites; even with renamed/hidden folders, burst them all up, to see how secure you are not.
            • We have one MODX installation that is running about 100 contexts and there is no issue whatsoever sharing the same css and indeed any other shared files since they all share the same filesystem. We just refer to the same CSS file in every context, such as:

              <link type="text/css" rel="stylesheet" href="/assets/css/main.css"/>
              


              We also always include a base tag:

              <base href="[[++site_url]]" />
              


              In terms of Extras, including pThumb, they just work as always, one or multiple contexts, with any number of domains for each context.