Implement the functionality of the main pages. Php

How to make a master page in php? How Layout.cshtml(s RenderBody()) in ASP.NET MVC?

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: http://jsfiddle.net/challenger/XgFGb/17/
+5
source share
7 answers

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!

+1
source

Here is what the PHP framework / api supports:

require("/definitions.php") , PHP- php://stdout ( - , ). require_once (php ).

open close PHP, - . , : normal page

( ) : enter image description here

" ", , PHP . , : " " (, , MVC).

+6

, , 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)

+1

Twig

Twig - . "" , , .

, symfony.

+1

( ) - Smarty , DisplayMaster ( "NameOfTemplate", "NameOfMasterTemplate" ).

, () .

2 : NameOfTemplate, , .

<div>...{$someProcessing}</div>

NameOfMasterTemplate html

<html>...<body><div class="layout">{$innerHtml}</div></body></html>
+1

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>  
+1
source

All Articles