diff options
author | Thomas Lange <code@nerdmind.de> | 2017-10-07 11:10:25 +0200 |
---|---|---|
committer | Thomas Lange <code@nerdmind.de> | 2017-10-07 11:10:25 +0200 |
commit | 80420baa5b6c42f016c041bc13264382cc50d698 (patch) | |
tree | 355c54b090849b4d1cba11fdf59e89229387a3c3 /include/pagelets.php | |
parent | 6550b64a5a6463bd371e13af82db86999b9363cc (diff) | |
download | bigpipe-80420baa5b6c42f016c041bc13264382cc50d698.tar.gz bigpipe-80420baa5b6c42f016c041bc13264382cc50d698.tar.xz bigpipe-80420baa5b6c42f016c041bc13264382cc50d698.zip |
The shorthand methods "addCSS" and "addJS" have been removed. If you need shorthand syntax, you can abstract the Pagelet class and use your own extended class which is more flexible and will keep the BigPipe main classes as small as possible.
Diffstat (limited to 'include/pagelets.php')
-rw-r--r-- | include/pagelets.php | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/include/pagelets.php b/include/pagelets.php index 4a86d49..cdb1a14 100644 --- a/include/pagelets.php +++ b/include/pagelets.php @@ -9,9 +9,8 @@ BigPipe\BigPipe::debugging(TRUE); #=============================================================================== $PageletRed = new BigPipe\Pagelet('redPL'); $PageletRed->addHTML('<section id="red" class="text">I AM A PAGELET WITH RED BACKGROUND</section>'); -$PageletRed->addCSS('static/red.php'); -$PageletRed->addCSS('static/red.php'); -$PageletRed->addJS('static/delayJS.php'); +$PageletRed->addResource(new BigPipe\Resource\Stylesheet(NULL, 'static/red.php')); +$PageletRed->addResource(new BigPipe\Resource\Javascript(NULL, 'static/delayJS.php')); $PageletRed->addJSCode("document.getElementById('red').innerHTML += ' [JS executed]';document.getElementById('red').style.borderRadius = '30px';"); #=============================================================================== @@ -19,9 +18,8 @@ $PageletRed->addJSCode("document.getElementById('red').innerHTML += ' [JS execut #=============================================================================== $PageletBlue = new BigPipe\Pagelet('bluePL', BigPipe\Pagelet::PRIORITY_HIGH); $PageletBlue->addHTML('<section id="blue" class="text">I AM A PAGELET WITH BLUE BACKGROUND</section>'); -$PageletBlue->addCSS('static/blue.php'); -$PageletRed->addCSS('static/red.php'); -$PageletBlue->addJS('static/delayJS.php'); +$PageletBlue->addResource(new BigPipe\Resource\Stylesheet(NULL, 'static/blue.php')); +$PageletBlue->addResource(new BigPipe\Resource\Javascript(NULL, 'static/delayJS.php')); $PageletBlue->addJSCode("document.getElementById('blue').innerHTML += ' [JS executed]';document.getElementById('blue').style.borderRadius = '30px';"); #=============================================================================== @@ -54,7 +52,7 @@ $PageletGreen = new BigPipe\Pagelet('greenPL'); } $PageletGreen->addHTML('<section id="green" class="text">I AM A PAGELET WITH GREEN BACKGROUND'.$InnerPagelet.'</section>'); -$PageletGreen->addCSS('static/green.php'); -$PageletGreen->addJS('static/delayJS.php'); +$PageletGreen->addResource(new BigPipe\Resource\Stylesheet(NULL, 'static/green.php')); +$PageletGreen->addResource(new BigPipe\Resource\Javascript(NULL, 'static/delayJS.php')); $PageletGreen->addJSCode("document.getElementById('green').innerHTML += ' [JS executed]';document.getElementById('green').style.borderRadius = '30px';"); ?>
\ No newline at end of file |