seedproject-api/core/View.php
Carlos Arias a447b17e69 Initial commit: SeedProject API framework
PHP MVC seed project with router, database layer, auth helpers,
LLM provider integrations, Stripe gateway, and console commands.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VVcDB9cRQZRRmUivMHRQGL
2026-09-14 16:15:41 -05:00

51 lines
No EOL
1.2 KiB
PHP

<?php
class View {
function __construct() {
//echo 'this is the view';
$this->path = VIEWS_PATH . '/views/';
}
public function render($name, $type='site', $noInclude = true) {
if(empty($type)) { $type = 'site'; }
$name = strtolower($name);
extract((array) $this);
if ($noInclude == false) {
require $this->path . "" . $name . ".php";
} else {
include $this->path . "wrapper/{$type}/header.php";
require $this->path . $name . ".php";
include $this->path . "wrapper/{$type}/footer.php";
}
}
/**
* generates partial view. Good for straight JSON or XML responses for internal views.
* @param $name
* @return string
*/
function PartialView($name, $param=false)
{
extract((array) $this);
ob_start();
include ($this->path . "partial/" . $name . ".php");
$name = ob_get_clean();
return ($name);
ob_end_flush();
}
function js($data){
print_array($data);
}
/*
public function render($name) {
require 'views/' . $name . '.php';
}
*/
}