-
-
Save greypants/5086024 to your computer and use it in GitHub Desktop.
PHP: Rails Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title><?php echo $page_title; ?></title> | |
</head> | |
<body> | |
<?php echo $content_for_layout; ?> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$page_title = 'Welcome to my website!'; | |
ob_start(); | |
?> | |
<h1>Welcome to my website!</h1> | |
<p>It's created using PHP's output buffering control.</p> | |
<?php | |
$content_for_layout = ob_get_clean(); | |
require_once( '_layout.php' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment