Quote from: mafokkenIs always having to copy the extras folder (/assets/components/..) over to several different Contexts really the only answer?
YES! for me, and only the Extras I need.
I would get a few things clear: your
default web Context is attached, as it were, to a local directory, the directory of your main site - www.mainfirstdomain.com. So any
physical files that Extras need, by default, are stored there and no where else.
You don't need to set base_url, site_url, and http_host for the web context (I don't!), if it is going to be using your main site's url or directory.
Extras that do not have physical files or need to call them will have no problems.
Extras and their authors don't know what or how many contexts/domains (Top Level Domains) you are going to be using.
Extras can have an
absolute or relative or root-relative linking to their files (CSS, js, images etc)
- Absolute = http://www.mainfirstdomain.com/assets/components/greatCIAextra/images/topbar.jpg
- Relative = assets/components/greatCIAextra/images/topbar.jpg
- Root-Relative = /assets/components/greatCIAextra/images/topbar.jpg
Maybe you want the Extra developer to use #1, so there won't be any problems? Some do, but then again they don't know your domain name, so they use the common placeholder,
[[++site_url]] to replace, say,
http://www.mainfirstdomain.com/
Problem::
[[++site_url]] changes its value when a different context with a different site url is in use, and that's where the Extras start getting discomfubabulated.
I usually want all my physical files under one domain name, to reduce external calls, that's why I duplicate the assets folder. It really is no biggie, in 4 clicks the whole process is painlessly over. If only one or two Extras get updated, I needn't duplicate the entire assets folder all over again, just those two, or one. Again, this is no trouble to me, still better than having multiple instances of MODx installation.
What else you can do, until someone else comes with a magical solution
- Create your own placeholder [[++firstDomain_url]] = http://www.mainfirstdomain.com/
- Edit the core of the Extras (and good luck here), if need be, and replace the [[++site_url]] with yours. So even if the Extra is making calls from your other Contexts, the absolute and fixed link will save matters.
- Use .htaccess to automatically rewrite all void links made to http://www.seconddomain.com/assets/components/greatCIAextra/images/topbar.jpg to http://www.mainfirstdomain.com/assets/components/greatCIAextra/images/topbar.jpg. Why, of course you'll need a more general rule.
In my useless opinion, I reckon, Extras developers should have the path to the Extras' physical files customizable, a variable :
[[mySlideExtra? &path=`
http://www.mainfirstdomain.com/`]] but I can't imagine what hell it'll be to achieve this or what pitfalls this might create.