Extension:IncludeOnlyNS

IncludeOnlyNS is designed to allow for one or more namespaces within a wiki to be designated as "Include Only", meaning that the page content may only be viewed if it is included on another page. The idea is to replicate the theoretical functionality of having a transcluded page with in the code. The use case for which this was developed was a wiki using and Semantic Forms. Semantic Forms does not allow for a form-based template to be placed in the middle of a page, so the solution was to "hide" the template on a related page in another namespace, and transclude it via a template.

IncludeOnlyNS.php
Save the following code as extensions/IncludeOnlyNS/IncludeOnlyNS.php

Changes to LocalSettings.php
Add the following line to LocalSettings:

Defining Namespaces as "Include-Only"
This would likely be done only with a custom namespace. For information on setting up custom namespaces, see the Manual on using custom namespaces.

Below the line to include the extension, define the array of namespaces which should be include-only. To define a "Data:" namespace as include-only, you would use: