Feature request: Themes path in a VAR

Feature request: Themes path in a VAR

by Jordi Duran -
Number of replies: 9
Dear Martin and developers team,

We are really happy to use Moodle. It's really powerful.

We are running a "own-patched" version of 1.4.3 to support Multi-Site/Virtualhosting. This patch is really simple....

In the config.php, we take the domain, check in our internal databases and then based on the domain we dinamically define dbHost, dbUser, dbName, dbPass (virtual host database), also wwwroot, dataroot while dirroot remains in the same value (copy of moodle programs not required).

Our "main" problem is with the THEMES, there is not a global var for the THEMES folder, you always refer to the THEMES directory trought ../theme/ or wwwroot/theme/

Our idea is to provide every single virtual host with their own themes directory, but to do that I need to modify at least 250 files of your current distribution...

I'm ready to do that job, but read in this forum that version 1.5, Themes will be more powerful and I don't want a make the changes twice...

Also, I think this var could be interesting for the comunity...

Then I decided to write this mail in order to sugest creation of a two new vars called $CFG->themeroot and $CFG->themedir with the path of the themes (server and webserver) and use it internally to locate the themes...

I will apreciate if you can tell us if this sugestion is of your interest.

Thanks for you great job.

Best Regards

Average of ratings: -
In reply to Jordi Duran

Re: Feature request: Themes path in a VAR

by Martín Langhoff -
At Catalyst we use a similar strategy, making config.php select the right database and datadir, while using a "shared" moodle setup.

If you want to prevent your clients from seeing themes that belong to other clients, use a prefix or other naming convention when naming the themes, and hack the themes selection page to display only the themes with the matching prefix.

This way, you make your change in one file instead of 250 smile
In reply to Martín Langhoff

Re: Feature request: Themes path in a VAR

by Jordi Duran -
Hi Martin Langhoff,

This is a "nice" patch, but will not allow our "users/customers" to edit or create the themes by them self.

Our idea is also provide FTP access to Themes dir as they have for the Doc dir.

In the mean while, I will use your idea...

Thanks
In reply to Jordi Duran

Re: Feature request: Themes path in a VAR

by Martín Langhoff -
If you are running on Linux, you could have each client on a separate theme directory, and use unionfs to merge them all. See http://www.linuxjournal.com/article/7714

It'd have the risk of collisions -- your clients should still use a prefix. Anyway, you're getting your wish from MD and don't need this trickery and magic ;)
In reply to Martín Langhoff

Re: Feature request: Themes path in a VAR

by Jordi Duran -
Hi ML,

Thanks for the article, it's really useful.
I can't apply it on my scenario, but it's good to know and I'm sure I will use it in the future.

Yes, It's great that MD has seen that modification interesting...

I will also useful to it is to avoid coping Themes everytime a new version comes in the upgrade process..

Best Regards
In reply to Jordi Duran

Re: Feature request: Themes path in a VAR

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It won't be useful to avoid copying themes, because Moodle is always gaining new styles ... You will still have to copy theme/standard to your external locations.

Another thing is that some of the themes will assume they are two directories deep when internally referring to graphics in the Moodle tree, etc, so watch out for that.

However, it will be most useful when multi-hosting different sites from one codebase, which is something I'd like to do for some of my clients.
In reply to Jordi Duran

Re: Feature request: Themes path in a VAR

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
It's a very good suggestion. If you can post a checklist of all the filenames that need changing that will make it easier for me to go through and put this in 1.5.
In reply to Martin Dougiamas

Re: Feature request: Themes path in a VAR

by Jordi Duran -
Hi Martin,

Yesterday I was wrong when I told you 250,... Today my number is 150 wink
Well perhaps is because we upgraded to version 1.4.4+, but I can bealive this difference is due to a version upgrade, probably I was wrong.

Here you have the list of files... (version 1.4.4+)

[root@campus root]# cd ~moodle
[root@campus moodle]# grep -l -r /theme/ .
./lib/weblib.php
./lib/setup.php
./mod/lesson/view.php
./rss/rsslib.php
./lang/be/docs/upgrade.html
./lang/be/docs/teacher.html
./lang/be/docs/install.html
./lang/be/docs/background.html
./lang/be/docs/releaseold.html
./lang/be/docs/developer.html
./lang/be/docs/cvs.html
./lang/be/docs/release.html
./lang/be/docs/intro.html
./lang/de/docs/upgrade.html
./lang/de/docs/features.html
./lang/de/docs/teacher.html
./lang/de/docs/install.html
./lang/de/docs/background.html
./lang/de/docs/developer.html
./lang/de/docs/cvs.html
./lang/de/docs/licence.html
./lang/de/docs/intro.html
./lang/de/docs/credits.html
./lang/cs/docs/upgrade.html
./lang/el/docs/upgrade.html
./lang/el/docs/faq.html
./lang/el/docs/future.html
./lang/el/docs/features.html
./lang/el/docs/teacher.html
./lang/el/docs/install.html
./lang/el/docs/coding.html
./lang/el/docs/background.html
./lang/el/docs/developer.html
./lang/el/docs/cvs.html
./lang/el/docs/other.html
./lang/el/docs/licence.html
./lang/el/docs/intro.html
./lang/el/docs/credits.html
./lang/el/docs/installamp.html
./lang/el/docs/glossary.html
./lang/en/docs/upgrade.html
./lang/en/docs/releaseold.html
./lang/es/docs/upgrade.html
./lang/es/docs/install.html
./lang/es/docs/releaseold.html
./lang/es/docs/developer.html
./lang/es/docs/installamp.html
./lang/es/docs/glossary.html
./lang/fr/docs/upgrade.html
./lang/fr/docs/releaseold.html
./lang/gl/docs/upgrade.html
./lang/gl/docs/faq.html
./lang/gl/docs/future.html
./lang/gl/docs/features.html
./lang/gl/docs/teacher.html
./lang/gl/docs/install.html
./lang/gl/docs/coding.html
./lang/gl/docs/background.html
./lang/gl/docs/releaseold.html
./lang/gl/docs/developer.html
./lang/gl/docs/cvs.html
./lang/gl/docs/other.html
./lang/gl/docs/licence.html
./lang/gl/docs/intro.html
./lang/gl/docs/credits.html
./lang/gl/docs/installamp.html
./lang/gl/docs/glossary.html
./lang/ja/docs/upgrade.html
./lang/it/docs/upgrade.html
./lang/it/docs/releaseold.html
./lang/nl/docs/upgrade.html
./lang/nl/docs/releaseold.html
./lang/no/docs/upgrade.html
./lang/no/docs/teacher.html
./lang/no/docs/install.html
./lang/no/docs/intro.html
./lang/pl/docs/upgrade.html
./lang/pl/docs/faq.html
./lang/pl/docs/future.html
./lang/pl/docs/features.html
./lang/pl/docs/index.html
./lang/pl/docs/teacher.html
./lang/pl/docs/install.html
./lang/pl/docs/coding.html
./lang/pl/docs/background.html
./lang/pl/docs/releaseold.html
./lang/pl/docs/developer.html
./lang/pl/docs/cvs.html
./lang/pl/docs/other.html
./lang/pl/docs/release.html
./lang/pl/docs/intro.html
./lang/pl/docs/credits.html
./lang/pl/docs/installamp.html
./lang/pl/docs/glossary.html
./lang/ru/docs/teacher.html
./lang/ru/docs/intro.html
./lang/sq/docs/upgrade.html
./lang/sq/docs/releaseold.html
./lang/sv/docs/upgrade.html
./lang/sv/docs/faq.html
./lang/sv/docs/future.html
./lang/sv/docs/features.html
./lang/sv/docs/teacher.html
./lang/sv/docs/install.html
./lang/sv/docs/coding.html
./lang/sv/docs/background.html
./lang/sv/docs/releaseold.html
./lang/sv/docs/developer.html
./lang/sv/docs/cvs.html
./lang/sv/docs/other.html
./lang/sv/docs/release.html
./lang/sv/docs/licence.html
./lang/sv/docs/intro.html
./lang/sv/docs/credits.html
./lang/sv/docs/installamp.html
./lang/sv/docs/glossary.html
./lang/uk/docs/faq.html
./lang/uk/docs/teacher.html
./lang/uk/docs/intro.html
./lang/fr_ca/docs/upgrade.html
./lang/fr_ca/docs/releaseold.html
./lang/zh_cn/docs/teacher.html
./lang/ja_utf8/docs/upgrade.html
./install.php
./admin/configure.php
./admin/index.php
./admin/blocks.php
./admin/modules.php
./theme/cornflower/header.html
./theme/metal/header.html
./theme/standardred/header.html
./theme/cordoroyblue/header.html
./theme/formal_white/header.html
./theme/poweraid/footer.html
./theme/poweraid/README.txt
./theme/poweraid/header.html
./theme/garden/header.html
./theme/oceanblue/header.html_logo
./theme/oceanblue/header.html
./theme/standardblue/header.html
./theme/standardlogo/header.html
./theme/brightretro/header.html
./theme/index.php
./theme/standard/header.html
./theme/standardgreen/header.html
./theme/standardwhite/header.html
./blocks/course_list/block_course_list.php
./blocks/moodleblock.class.php
./course/lib.php
./course/index.php
./course/scales.php
./course/info.php
./course/category.php
In reply to Jordi Duran

Re: Feature request: Themes path in a VAR

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
Actually, the actual number we need to change in 1.5 is far fewer than that (5 or 6 files!) but thanks anyway.

I've called them $CFG->themedir and $CFG->themewww
In reply to Martin Dougiamas

Re: Feature request: Themes path in a VAR

by Jordi Duran -
Hi Martin

That's perfect. I will test the 1.5dev in our testing environment, and wait for the final realese of it.

Many Thanks.