/[drupal]/contributions/sandbox/crell/pageoo.php
ViewVC logotype

Contents of /contributions/sandbox/crell/pageoo.php

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download) (as text)
Wed Sep 19 08:33:01 2007 UTC (2 years, 2 months ago) by crell
Branch: MAIN
CVS Tags: HEAD
File MIME type: text/x-php
- Add page OO demo file.
1 <?php
2
3
4 class Response {
5
6 static $regions = array();
7
8
9 }
10
11
12 function hook_menu() {
13 $items['foo/bar'] = array(
14 'title' => 'test',
15 'callback' => 'example_foo',
16 'response_type' => 'page',
17 );
18 $items['foo/json'] = array(
19 'title' => 'json_test',
20 'callback' => 'example_json',
21 'response_type' => 'json',
22 );
23 $items['foo/ahah'] = array(
24 'title' => 'ahah_test',
25 'callback' => 'example_ahah',
26 'response_type' => 'ahah',
27 );
28
29 return $items;
30 }
31
32 function example_foo() {
33 return 'test';
34 }
35
36 function example_json() {
37 return json_encode('hello');
38 }
39
40 function example_ahah() {
41 return 'page part';
42 }
43
44 function menu_execute_active_handler() {
45 $item = menu_get_active_item();
46 Response::setType($item['response_type']);
47 Response::setBody(call_user_func($item['callback']));
48 }
49
50 menu_execute_active_item();
51 execute_sideband_stuff_like_blocks();
52
53 Response::display();
54

  ViewVC Help
Powered by ViewVC 1.1.2