by Davo Smith.
view.php:
AJAX_SCRIPT has been there since Moodle 2.0 (unless I'm mistaken).
You might want to consider the following variation on your AJAX page:
ajax-page.php:
define('AJAX_SCRIPT', true);
require_once('../../config.php');
require_once('lib.php');
myclass::view();
require_once('../../config.php');
require_once('lib.php');
myclass::view();
view.php:
require_once('../../config.php');
require_once('lib.php');
...
echo$PAGE->header();
myclass::view();
echo$PAGE->footer();
require_once('lib.php');
...
echo$PAGE->header();
myclass::view();
echo$PAGE->footer();
lib.php:
By routing most of your logic through a class in a library file, you eliminate many of the problems of multiple entry points, whilst retaining much of the code clarity that comes from them.