⊗ppMVDFmRLt 32 of 35 menu

Kendi MVC Framework'ü için renderLayout Metodu

Şimdi renderLayout metodunu yapalım. Bu metod, layout dosyasını alacak ve içine $title değişkeninin değerini ve $content değişkenini (metoda parametre olarak geçilecek ve renderView metodunun çalışma sonucunu temsil edecek) yerleştirecek:

<?php private function renderLayout(Page $page, $content) { $layoutPath = $_SERVER['DOCUMENT_ROOT'] . "/project/layouts/{$page->layout}.php"; if (file_exists($layoutPath)) { ob_start(); $title = $page->title; include $layoutPath; // burada $title ve $content değişkenleri erişilebilir olacak return ob_get_clean(); } } ?>
Türkçe
AfrikaansAzərbaycanБългарскиবাংলাБеларускаяČeštinaDanskDeutschΕλληνικάEnglishEspañolEestiSuomiFrançaisहिन्दीMagyarՀայերենIndonesiaItaliano日本語ქართულიҚазақ한국어КыргызчаLietuviųLatviešuМакедонскиMelayuမြန်မာNederlandsNorskPolskiPortuguêsRomânăРусскийසිංහලSlovenčinaSlovenščinaShqipСрпскиSrpskiSvenskaKiswahiliТоҷикӣไทยTürkmenЎзбекOʻzbekTiếng Việt
Web sitesinin çalışması, analiz ve kişiselleştirme için çerezleri kullanıyoruz. Veri işleme, Gizlilik Politikası'na uygun olarak gerçekleşir.
tümünü kabul et özelleştir reddet