getLast()) { $User = $UserRepository->find($Page->get('user')); $PageItemTemplate = generatePageItemTemplate($Page, $User); } if($Post = $PostRepository->getLast()) { $User = $UserRepository->find($Post->get('user')); $PostItemTemplate = generatePostItemTemplate($Post, $User); } if($User = $UserRepository->getLast()) { $UserItemTemplate = generateUserItemTemplate($User); } #=============================================================================== # Build document #=============================================================================== $HomeTemplate = Template\Factory::build('home'); $HomeTemplate->set('LAST', [ 'PAGE' => $PageItemTemplate ?? false, 'POST' => $PostItemTemplate ?? false, 'USER' => $UserItemTemplate ?? false ]); $HomeTemplate->set('COUNT', [ 'PAGE' => $PageRepository->getCount(), 'POST' => $PostRepository->getCount(), 'USER' => $UserRepository->getCount() ]); $MainTemplate = Template\Factory::build('main'); $MainTemplate->set('NAME', 'Dashboard'); $MainTemplate->set('HTML', $HomeTemplate); echo $MainTemplate;