blob: 43d1992a1f1b44dae879115023c0d53784e42e0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
<?php
#===============================================================================
# Enable debugging mode
#===============================================================================
$DEBUGGING = TRUE;
#===============================================================================
# Namespace paths based on whether the debugging mode is enabled
#===============================================================================
$pagelet = ($DEBUGGING ? 'Debugging' : 'BigPipe').'\Pagelet';
$stylesheet = ($DEBUGGING ? 'Debugging' : 'BigPipe').'\Resource\Stylesheet';
$javascript = ($DEBUGGING ? 'Debugging' : 'BigPipe').'\Resource\Javascript';
#===============================================================================
# Pagelet with red background color
#===============================================================================
$PageletRed = new $pagelet('redPL');
$PageletRed->addHTML('<section id="red" class="text">I AM A PAGELET WITH RED BACKGROUND</section>');
$PageletRed->addResource(new $stylesheet(NULL, 'static/red.php'));
$PageletRed->addResource(new $javascript(NULL, 'static/delayJS.php'));
$PageletRed->addJSCode("document.getElementById('red').innerHTML += ' [JS executed]';document.getElementById('red').style.borderRadius = '30px';");
#===============================================================================
# Pagelet with blue background color
#===============================================================================
$PageletBlue = new $pagelet('bluePL', BigPipe\Pagelet::PRIORITY_HIGH);
$PageletBlue->addHTML('<section id="blue" class="text">I AM A PAGELET WITH BLUE BACKGROUND</section>');
$PageletBlue->addResource(new $stylesheet(NULL, 'static/blue.php'));
$PageletBlue->addResource(new $javascript(NULL, 'static/delayJS.php'));
$PageletBlue->addJSCode("document.getElementById('blue').innerHTML += ' [JS executed]';document.getElementById('blue').style.borderRadius = '30px';");
#===============================================================================
# Pagelet with green background color
#===============================================================================
$PageletGreen = new $pagelet('greenPL');
{
#===============================================================================
# Pagelet within $PageletGreen
#===============================================================================
// The addDependency call is required to ensure that $InnerPagelet will only be
// executed if the HTML from the $PageletGreen has ALREADY DISPLAYED. Otherwise,
// $InnerPagelet would not find his placeholder tag which is defined WITHIN the
// HTML on $PageletGreen. Of course, you can still add other pagelets as
// dependency. Then will $InnerPagelet only displayed if all dependencies are
// already displayed!
//
// NOTE: PRIORITY_HIGHEST is only set so that you can see, that this pagelet is
// the first which arrives, but it will first be displayed if his dependency
// pagelets are already displayed.
$InnerPagelet = new $pagelet('innerPL', BigPipe\Pagelet::PRIORITY_HIGHEST);
// NOTICE: You can also use the Pagelet ID (as string) as argument. May be helpful
// if a dependency Pagelet object is not accessible within the current scope.
$InnerPagelet->addDependency($PageletGreen);
$InnerPagelet->addHTML('<section sytle="background:#FFF;padding:5px;">Inner Pagelet \(o_o)/</section>');
}
$PageletGreen->addHTML('<section id="green" class="text">I AM A PAGELET WITH GREEN BACKGROUND'.$InnerPagelet.'</section>');
$PageletGreen->addResource(new $stylesheet(NULL, 'static/green.php'));
$PageletGreen->addResource(new $javascript(NULL, 'static/delayJS.php'));
$PageletGreen->addJSCode("document.getElementById('green').innerHTML += ' [JS executed]';document.getElementById('green').style.borderRadius = '30px';");
?>
|