seedproject-web/api/core/View.php
Carlos Arias 1559ce017d chore: scaffold SeedProject base (Phase 1)
Clean-room copy of the reusable engines from comiida, with all
instance data, secrets, dependencies, and build output excluded:
- app/         Astro theme skeleton (no comiida blog posts; hero image -> placeholder)
- api/         SeedProject PHP framework (no vendor/.env/config.php)
- content-pipeline/  engine only (scripts/admin/prompts; empty runtime state)
- astroagent.config.json + app/.astroagent/skills

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SYHWLHihq3v9nxNwoPCKSn
2026-07-04 22:53:10 +00: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';
}
*/
}