Guest User

Untitled

a guest
Jun 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. <?php
  2. function cat_menu() {
  3. $items['ajax_node/%'] = array(
  4. 'page callback' => 'cat_print_json',
  5. 'page arguments' => array(1),
  6. 'type' => MENU_CALLBACK,
  7. 'access callback' => true
  8. );
  9.  
  10. return $items;
  11. }
  12.  
  13. /*
  14. * JSON Output of node
  15. */
  16. function cat_print_json($nid) {
  17. $node = node_load($nid);
  18. $data['body'] = $node->body['und'][0]['safe_value'];
  19.  
  20. print drupal_json_encode($data);
  21. exit();
  22. }
  23. ?>
Add Comment
Please, Sign In to add comment