Welcome, Guest
Username: Password: Remember me

TOPIC: Dynamic $rooturl to eliminate an install/config step

Dynamic $rooturl to eliminate an install/config step 3 years 7 months ago #55557

  • starmonkey
  • starmonkey's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
Hi all, not sure where this belongs, but I just thought I'd share a hack with you guys, mainly to make sure I'm not doing something bad.

I prefer my php webapps to work out as much of their environment as possible, to save on configuration steps.

As such, I edited config.php with the following:
// The root web url for your limesurvey installation (without a trailing slash).
//$rooturl = "http://{$_SERVER['HTTP_HOST']}/path/to/limesurvey"; 
// SM 20Jan11: Dynamic rooturl, for /admin pages, set one level up
$rooturl = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
if('admin' == basename($rooturl)) { $rooturl = dirname($rooturl); }

Anyway, feedback welcome. I did this because my dev/staging and live environments have different paths/urls, and I got tired of maintaining different settings per environment!

// SM
Last Edit: 3 years 7 months ago by starmonkey.
The administrator has disabled public write access.

Re: Dynamic $rooturl to eliminate an install/config step 3 years 7 months ago #55561

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
I think the best way to discuss coding details is to open a new ticket at oiur bugtracker so we can assign this issue to a certain developer.
Please have a look at docs.limesurvey.org/How+to+contribute+new+features

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.

Re: Dynamic $rooturl to eliminate an install/config step 3 years 7 months ago #55594

  • starmonkey
  • starmonkey's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 9
  • Karma: 0
Cheers, Mazi.

I created the following in mantis:

bugs.limesurvey.org/view.php?id=4896
The administrator has disabled public write access.

Re: Dynamic $rooturl to eliminate an install/config step 3 years 7 months ago #55618

  • Mazi
  • Mazi's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 5325
  • Thank you received: 296
  • Karma: 249
Thanks for your contribution, we will discuss it at the bugtracker.

Best regards/Beste Grüße,
Dr. Marcel Minke
(Limesurvey Head of Support)
Need Help? We offer professional Limesurvey support
Contact: marcel.minke(at)limesurvey.org'"
The administrator has disabled public write access.
Time to create page: 0.137 seconds
Donation Image