How to make a master page in php? How Layout.cshtml(s RenderBody()) in ASP.NET MVC?
php
Layout.cshtml
RenderBody()
Thank!
PS Maybe there is a third-party tool for this purpose?
EDIT
Ok It's not about MVC architecture! Have a look here: http://jsfiddle.net/challenger/8qn22/109/
I want the master page/layout to stay when user gets redirected to the other page
Want an average page to be nested inside the content division
So if it is a form I want this form to be displayed like:
Ok The solution that suits me best is described here http://www.phpro.org/tutorials/Introduction-to-PHP-templating.html#9 . It is easy, fast, and you cannot use the template engine. Cool!
Here is what the PHP framework / api supports:
require("/definitions.php") , PHP- php://stdout ( - , ). require_once (php ).
require("/definitions.php")
require_once
open close PHP, - . , :
( ) :
" ", , PHP . , : " " (, , MVC).
, , Laravel framework Blade templating . , Razor.
:
@layout('master') @section('navigation') @parent <li>Nav Item 3</li> @endsection @section('content') Welcome to the profile page! @endsection
(Razor, Blade, loller skates)
PHP , templating. . , (Smarty, PHPTAL XTemplate, ).
"" -, . () .
Zend Framework , . , -.
. :
Twig
Twig - . "" , , .
, symfony.
( ) - Smarty , DisplayMaster ( "NameOfTemplate", "NameOfMasterTemplate" ).
, () .
2 : NameOfTemplate, , .
<div>...{$someProcessing}</div>
NameOfMasterTemplate html
<html>...<body><div class="layout">{$innerHtml}</div></body></html>
Add this piece of code to the content area of ββyour master.php file ... I use it like this and it works fine for me.
<li><a href="master.php?page=blog.php">BLOG</a></li>
<div class="container content"> <?php if(isset($_GET['page'])) { $page_name = $_GET['page']; include("/".$page_name); } ?> </div>