The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.27 (Linux)
|
![]() |
Autotomatically resolve base/root path for Formtools - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: Feature Suggestions (https://forums.formtools.org/forumdisplay.php?fid=7) +--- Thread: Autotomatically resolve base/root path for Formtools (/showthread.php?tid=1260) |
Autotomatically resolve base/root path for Formtools - crunchers - May 5th, 2011 Just a suggestion: In the Formtools main config.php file, use the following(?) to define $g_root_url and $g_root_dir: PHP Code: $g_root_url = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == "on") ? "https" : "http"); I can't remember how these are defined by default but the above snippet will automatically calculate both the base and root paths for FormTools (you could even go as far as excluding it from the config file altogether and place it in the core). I've used something similar before on Codeigniter and thought it may prove useful for future releases, Ben. RE: Autotomatically resolve base/root path for Formtools - Ben - May 5th, 2011 Hi Crunchers, Yeah, I had the same thought! In fact, I did something like that on another script of mine for a while. But I got burned by it: the SCRIPT_NAME and some other commonly available $_SERVER contents weren't being doled up on a particular the server. According to the PHP specs, technically they may not be available. Chances are it was just an anomaly, but it's made me nervous about relying on it. Eventually, what I'll do is examine the way other popular PHP scripts (like Wordpress, Drupal etc) are doing it these days. If I *can* do away with having those variables set, that would be terrific. - Ben RE: Autotomatically resolve base/root path for Formtools - crunchers - May 5th, 2011 PITA problem you ran into there. One way round it, I suppose, is to check for this anomaly during installation and fall back on prompting the user to adjust it manually if the condition fails. I guess the flip-side is you'd be creating more work re:logic. Time better spent elsewhere etc. Just thinking out loud really... Thanks, Ben. RE: Autotomatically resolve base/root path for Formtools - Ben - May 5th, 2011 But very welcome! I appreciate the ideas - it's good to get reminders of these things. There's always things that can be improved. - Ben |