Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $header = template('header', ['title' => 'Hello World!']);
- $content = template('content', ['content' => "Lorem ipsum...", 'meta' => 'Author info']);
- $footer = template('footer', ['copy' => "Copyright ". date('Y')]);
- // ...skipped logic
- echo $header, $content, $footer;
- /**
- * @param string $template
- * @param array $vars
- * @return string
- */
- function template($template, $vars) {
- // place your code here
- // ...
- }
- !-- header.phtml -->
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title><?=$title?></title>
- </head>
- <body>
- <!-- content.phtml -->
- <div class="container">
- <p><?=$content?></p>
- <p><?=$meta?></p>
- </div>
- <!-- footer.phtml -->
- <footer>
- <?=$copy?>
- </footer>
- </body>
- </html>
Add Comment
Please, Sign In to add comment