Skip to main content
added 49 characters in body
Source Link
Andrew Welch
  • 2.6k
  • 4
  • 29
  • 53

Something like this. Do youyour hook menu wihtwith (optional) arguments. Then inIn the callback do an entityFieldQuery and looks up(or pull in your item and then do anXML). Use hook_theme to specify a custom template. Sorry this code isn't tested and will need some editing / adapting for your use context.

Or perhapsIf you prefer to pull in a feed maybe https://www.drupal.org/project/feeds is what you are looking for.

//menu

/**
     * Implements hook_menu().
     */
    function example_menu() {
      $items = array();
      $items['example_object/something/%'] = array(
        'title' => t('callback'),
        'page callback' => '_example_mystuff',
        'page arguments' => array(
          0,
          1,
          2
        ),
        'access arguments' => array(
          ''
        ),
        'type' => MENU_CALLBACK
      );
      return $items;
    }

//callback

     function _example_mystuff($arg1, $arg2, $arg3) {
        $query = new EntityFieldQuery();
//or load in your xml
        //do an entity field query to look up your items
         $results = $query->execute();
        return $results;
        }

//theme function

 function example_theme($existing, $type, $theme, $path) {
      return array(
    '_example_mystuff' => array(
          'template' => 'example-theme',
          'path' => $path . '/templates',
          'variables' => array(
            'variables' => NULL
          )
        )
    }

Something like this. Do you hook menu wiht arguments. Then in the callback do an entityFieldQuery and looks up your item and then do an hook_theme to specify a custom template. Sorry this code isn't tested and will need some editing.

Or perhaps https://www.drupal.org/project/feeds is what you are looking for.

//menu

/**
     * Implements hook_menu().
     */
    function example_menu() {
      $items = array();
      $items['example_object/something/%'] = array(
        'title' => t('callback'),
        'page callback' => '_example_mystuff',
        'page arguments' => array(
          0,
          1,
          2
        ),
        'access arguments' => array(
          ''
        ),
        'type' => MENU_CALLBACK
      );
      return $items;
    }

//callback

     function _example_mystuff($arg1, $arg2, $arg3) {
        $query = new EntityFieldQuery();
//or load in your xml
        //do an entity field query to look up your items
         $results = $query->execute();
        return $results;
        }

//theme function

 function example_theme($existing, $type, $theme, $path) {
      return array(
    '_example_mystuff' => array(
          'template' => 'example-theme',
          'path' => $path . '/templates',
          'variables' => array(
            'variables' => NULL
          )
        )
    }

Something like this. Do your hook menu with (optional) arguments. In the callback do an entityFieldQuery (or pull in your XML). Use hook_theme to specify a custom template. this code isn't tested and will need some editing / adapting for your use context.

If you prefer to pull in a feed maybe https://www.drupal.org/project/feeds is what you are looking for.

//menu

/**
     * Implements hook_menu().
     */
    function example_menu() {
      $items = array();
      $items['example_object/something/%'] = array(
        'title' => t('callback'),
        'page callback' => '_example_mystuff',
        'page arguments' => array(
          0,
          1,
          2
        ),
        'access arguments' => array(
          ''
        ),
        'type' => MENU_CALLBACK
      );
      return $items;
    }

//callback

     function _example_mystuff($arg1, $arg2, $arg3) {
        $query = new EntityFieldQuery();
//or load in your xml
        //do an entity field query to look up your items
         $results = $query->execute();
        return $results;
        }

//theme function

 function example_theme($existing, $type, $theme, $path) {
      return array(
    '_example_mystuff' => array(
          'template' => 'example-theme',
          'path' => $path . '/templates',
          'variables' => array(
            'variables' => NULL
          )
        )
    }
Source Link
Andrew Welch
  • 2.6k
  • 4
  • 29
  • 53

Something like this. Do you hook menu wiht arguments. Then in the callback do an entityFieldQuery and looks up your item and then do an hook_theme to specify a custom template. Sorry this code isn't tested and will need some editing.

Or perhaps https://www.drupal.org/project/feeds is what you are looking for.

//menu

/**
     * Implements hook_menu().
     */
    function example_menu() {
      $items = array();
      $items['example_object/something/%'] = array(
        'title' => t('callback'),
        'page callback' => '_example_mystuff',
        'page arguments' => array(
          0,
          1,
          2
        ),
        'access arguments' => array(
          ''
        ),
        'type' => MENU_CALLBACK
      );
      return $items;
    }

//callback

     function _example_mystuff($arg1, $arg2, $arg3) {
        $query = new EntityFieldQuery();
//or load in your xml
        //do an entity field query to look up your items
         $results = $query->execute();
        return $results;
        }

//theme function

 function example_theme($existing, $type, $theme, $path) {
      return array(
    '_example_mystuff' => array(
          'template' => 'example-theme',
          'path' => $path . '/templates',
          'variables' => array(
            'variables' => NULL
          )
        )
    }
Post Made Community Wiki by Andrew Welch