Created
January 28, 2014 22:15
-
-
Save russelporosky/8677698 to your computer and use it in GitHub Desktop.
How to make a layout/view combo with AuraView.
This file contains hidden or 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 | |
$view_manager = new \Aura\View\Manager( | |
new \Aura\View\Template, | |
new \Aura\View\Helper, | |
new \Aura\View\Finder, | |
new \Aura\View\Finder | |
); | |
echo $view_manager->render( | |
array( | |
'someText' => '<p>This is some body text</p>', | |
'pageTitle' => 'Title of the Page' | |
), | |
function() { | |
// A view file that will be inserted as $content into the layout file. | |
ob_start(); | |
require('view.php'); | |
echo ob_get_clean(); | |
}, | |
function() { | |
// A layout file that contains a header, footer and space for the view file contents. | |
ob_start(); | |
require('layout.php'); | |
echo ob_get_clean(); | |
} | |
); |
This file contains hidden or 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 | |
// A layout file. Contains the wrapping HTML tags. | |
?> | |
<html> | |
<head> | |
<title><?php echo $pageTitle; ?></title> | |
</head> | |
<body> | |
<?php echo $content; ?> | |
</body> | |
</html> |
This file contains hidden or 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 | |
// A view file. The contents of this file will be available to the layout as $content. | |
?> | |
<p>This is the view file.</p> | |
<?php echo $someText; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment