From 19c0af6809b8db0b763565fa9b273c90da3d1894 Mon Sep 17 00:00:00 2001 From: Thomas Lange Date: Sat, 22 Oct 2016 01:08:22 +0200 Subject: The Pagelet representation class in PHP now has a separate method to add dependencies (either with the instance of the dependency Pagelet or the unique ID as string as argument). --- include/pagelets.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/pagelets.php') diff --git a/include/pagelets.php b/include/pagelets.php index 9725879..4a86d49 100644 --- a/include/pagelets.php +++ b/include/pagelets.php @@ -33,7 +33,7 @@ $PageletGreen = new BigPipe\Pagelet('greenPL'); #=============================================================================== # Pagelet within $PageletGreen #=============================================================================== - // The third parameter is required to ensure that the $InnerPagelet will only be + // 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 @@ -44,7 +44,12 @@ $PageletGreen = new BigPipe\Pagelet('greenPL'); // the first which arrives, but it will first be displayed if his dependency // pagelets are already displayed. - $InnerPagelet = new BigPipe\Pagelet('innerPL', BigPipe\Pagelet::PRIORITY_HIGHEST, [$PageletGreen->getID()]); + $InnerPagelet = new BigPipe\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('
Inner Pagelet \(o_o)/
'); } -- cgit v1.2.3