/** * Exibe uma view. * Função inspirada na usada pelo Laravel 4. Veja: http://laravel.com/docs/4.2/responses#views * * @link http://laravel.com/docs/4.2/responses#views * @param string $viewName Nome da view, que é o nome do arquivo em lib/views, sem o ".php" * @param array $customVars (opcional) Array com variáveis que serão usadas na view */ public static function make($viewName, array $customVars = array()) { // cria as variáveis do array $customVars extract($customVars); // inclui o template, que vai processar a view na variável $viewName require_once viewsPath() . 'template.php'; }
public function view($name, array $customVars = array()) { // Cria as variaveis extract($customVars); // Cria o caminho da view $path = viewsPath() . $name . '.php'; // Verifica se existe o caminho e inclui a view if (file_exists($path)) { require_once $path; } }
/** * Assets Generator * * @category Pulse * @package Pulse * @author Ferdinand Martin * @since File available since Release 1.0.0 */ function asset($resource) { if (substr($resource, -3) == 'css') { $asset = basePath() . '/' . viewsPath() . '/css/' . $resource; } if (substr($resource, -3) == '.js') { $asset = basePath() . '/' . viewsPath() . '/js/' . $resource; } if (substr($resource, -3) == 'peg') { $asset = basePath() . '/' . viewsPath() . '/images/' . $resource; } if (substr($resource, -3) == 'png') { $asset = basePath() . '/' . viewsPath() . '/images/' . $resource; } if (substr($resource, -3) == 'gif') { $asset = basePath() . '/' . viewsPath() . '/images/' . $resource; } if (substr($resource, -3) == 'jpg') { $asset = basePath() . '/' . viewsPath() . '/images/' . $resource; } if (substr($resource, -3) == 'svg') { $asset = basePath() . '/' . viewsPath() . '/images/' . $resource; } if (substr($resource, 0, 4) == 'jque') { $asset = basePath() . '/' . viewsPath() . '/resources/' . $resource; } if (substr($resource, 0, 4) == 'boot') { $asset = basePath() . '/' . viewsPath() . '/resources/' . $resource; } if (substr($resource, 0, 4) == 'font') { $asset = basePath() . '/' . viewsPath() . '/resources/' . $resource; } if (empty($asset)) { $asset = basePath() . '/' . viewsPath() . '/resources/' . $resource; } return $asset; }
<div class="row" style="margin: 30px 50px 10px 0;"> <div class="alert alert-danger"> <?php echo $flashErrorMessage; ?> </div> </div> <?php } ?> <?php if (isset($viewName)) { $path = viewsPath() . $viewName . '.php'; if (file_exists($path)) { require_once $path; } } ?> </div><!-- /.container --> <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> <script src="<?php getBaseURL(); ?> /js/jquery-1.11.2.min.js"></script> <!-- Include all compiled plugins (below), or include individual files as needed --> <script src="<?php