AJAXify doesn't work with path alias. If node/5 has alias page/about, ajaxify couldn't use the alias /ajaxify/div.node/page/about.

Calling drupal_init_path() before menu_execute_active_handler() invoked solves this.

function ajaxify_init() {
  // Get current query
  $q = $_GET['q'];
  $path = explode('/', $q);
  if (array_shift($path) == 'ajaxify') {
    // Find the element requested
    $el = array_shift($path);
    // Correct wrong URLs
    global $base_url;
    $base_path = explode('/', $base_url);
    // Find intersection between incoming request and base URL
    $path_itersection = implode('/', array_intersect($base_path, $path));
    if ($path_itersection) {
      $path = str_replace($path_itersection .'/', '', implode('/', $path));
    }
    else {
      $path = implode('/', $path);
    }
    // Find the handler to execute
    $_GET['q'] = $path;
    drupal_init_path();  // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< here
    // The following code is exactly index.php
    $return = menu_execute_active_handler();
    // Menu status constants are integers; page content is a string.
    if (is_int($return)) {
    ....

Comments

owahab’s picture

Status: Needs review » Reviewed & tested by the community

Looks like it's working fine.

owahab’s picture

Status: Reviewed & tested by the community » Fixed
Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.