Forum OpenACS Q&A: apm_package_id_from_key rant

Collapse
Posted by Ola Hansson on
For a package like (for instance) ACS Developer Support that has got a "widget" which needs to be shown in the footer of many pages, be it you're requesting / or /forums/ or /ds/, it's kind of necessery, I suppose, to use a proc such as apm_package_id_from_key. The _from_key part suggests that only one value will be returned since a package key is unique - in this case the package_id of the one and only instance that can (or should) be mounted. Why must we use apm_package_id_from_key? Because we must get the package_id of DS even if we are visiting /news. Using ad_conn package_id would return the package_id of the visited news instance...

Using apm_package_id_from_key has the sad consequence that the package is doomed to be a singleton (that is it can only be mounted once (per sub-site)).

I am right in saying it can be mounted in another sub-site, ain't I?

A "regular" package, OTOH, that can make use of [ad_conn package_id] (because its scripts are always requested from inside its own package_id node) benefits from the possibility to be a non singleton and a "package aware" package.

Hmmm. This rant has too many commas, parenthesis and doublequotes... Oh well.😉

And please correct me if I am wrong!