diff options
-rw-r--r-- | index.php | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -637,6 +637,29 @@ class pageBuilder | |||
637 | $this->tpl->assign($what,$where); | 637 | $this->tpl->assign($what,$where); |
638 | } | 638 | } |
639 | 639 | ||
640 | /** | ||
641 | * Assign an array of data to the template builder. | ||
642 | * | ||
643 | * @param array $data Data to assign. | ||
644 | * | ||
645 | * @return false if invalid data. | ||
646 | */ | ||
647 | public function assignAll($data) | ||
648 | { | ||
649 | // Lazy initialization | ||
650 | if ($this->tpl === false) { | ||
651 | $this->initialize(); | ||
652 | } | ||
653 | |||
654 | if (empty($data) || !is_array($data)){ | ||
655 | return false; | ||
656 | } | ||
657 | |||
658 | foreach ($data as $key => $value) { | ||
659 | $this->assign($key, $value); | ||
660 | } | ||
661 | } | ||
662 | |||
640 | // Render a specific page (using a template). | 663 | // Render a specific page (using a template). |
641 | // e.g. pb.renderPage('picwall') | 664 | // e.g. pb.renderPage('picwall') |
642 | public function renderPage($page) | 665 | public function renderPage($page) |