<![CDATA[ API mapPath function removed? AAARGH! - MODX Community Forums]]> https://forums.modx.com/thread/?thread=36392 <![CDATA[Re: API mapPath function removed? AAARGH!]]> https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205283 opengeek Aug 08, 2008, 01:40 PM https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205283 <![CDATA[Re: API mapPath function removed? AAARGH!]]> https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205282 http://wiki.modxcms.com/index.php/API:mapPath]]> sottwell Aug 08, 2008, 01:21 PM https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205282 <![CDATA[Re: API mapPath function removed? AAARGH!]]> https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205281 opengeek Aug 08, 2008, 09:08 AM https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205281 <![CDATA[Re: API mapPath function removed? AAARGH!]]> https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205280 Quote from: OpenGeek at Aug 07, 2008, 10:58 PM

Not sure why you were using that function, but the mapPath() function was incorrect and rather than fix it and leave many different ways to get to the paths, it is recommended that you use the constants defined for these paths:

Mainly because it’s in the documentation: http://modxcms.com/mappath.html, whereas I couldn’t find the constants in the docs anywhere. When an API function is documented, you don’t tend to think it’s use is unsafe, or going to be removed.

Quote from: OpenGeek at Aug 07, 2008, 10:58 PM
I’ve written a lot of components for MODx and never been even tempted to use mapPath(). It probably should not have been just removed (bit hasty), but it would help you transition to Revolution more easily if you went ahead and modified your use of mapPath with the configuration variables or constants above; these will always be available and always accurate. This change will allow us to solve some long-standing issues in making the manager easier to get working on more environments.

OK I’ll change to use a constant as long as they’re going to stay around. A better approach would have been to "depreciate" the function - if user has error reporting turned on, log or display a warning: "this function has been deprecated, please use MODX_BASE_PATH or $modx->config[’base_path’] instead."

The change you made could break sites completely (like my development site) - but if this was a stable release, and I’d gone and installed it over my 0.9.6.1 live site, it would have destroyed my live site.]]>
Pandy06269 Aug 08, 2008, 01:42 AM https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205280
<![CDATA[Re: API mapPath function removed? AAARGH!]]> https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205279
MODX_BASE_PATH
MODX_BASE_URL
MODX_SITE_URL
MODX_MANAGER_PATH
MODX_MANAGER_URL

or the config equivalents:

$modx->config[’base_path’]
$modx->config[’base_url’]
$modx->config[’site_url’]
$modx->config[’manager_path’]
$modx->config[’manager_url’]

which can also be used in tags:

[(base_path)]
[(base_url)]
[(site_url)]
[(manager_path)]
[(manager_url)]

I’ve written a lot of components for MODx and never been even tempted to use mapPath(). It probably should not have been just removed (bit hasty), but it would help you transition to Revolution more easily if you went ahead and modified your use of mapPath with the configuration variables or constants above; these will always be available and always accurate. This change will allow us to solve some long-standing issues in making the manager easier to get working on more environments.]]>
opengeek Aug 07, 2008, 05:58 PM https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205279
<![CDATA[Re: API mapPath function removed? AAARGH!]]> https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205278 Pandy06269 Aug 07, 2008, 05:17 PM https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205278 <![CDATA[API mapPath function removed? AAARGH!]]> https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205277
Fatal error: Call to undefined method DocumentParser::mapPath() in /srv/www/htdocs/sanctree/manager/includes/document.parser.class.inc.php(769) : eval()’d code on line 20

Has mapPath() disappeared from the API? I’ve used it in practically every snippet, module and plugin I’ve ever written.
It worked in 0.9.6.2-rc1. IMHO you shouldn’t remove such a vital function in an API within -rc releases - it’s going to be a major task for me to change this particular bit of code, having spent the last 3 months building on 0.9.6.2-rc1.

Is there an alternative way of finding the MODx path without hard-coding, or reading the config file in every snippet etc?]]>
Pandy06269 Aug 07, 2008, 05:00 PM https://forums.modx.com/thread/36392/api-mappath-function-removed-aaargh#dis-post-205277