Exception
Template not found: search/index Exception thrown with message "Template not found: search/index" Stacktrace: #8 Exception in /home/kornich/htdocs/kornich.com/framework/Response.php:431 #7 Response:compileTemplateWithLayout in /home/kornich/htdocs/kornich.com/framework/Response.php:321 #6 Response:render in /home/kornich/htdocs/kornich.com/modules/realestate/controllers/Search.php:62 #5 Search:index in /home/kornich/htdocs/kornich.com/framework/Router.php:241 #4 Router:detect in /home/kornich/htdocs/kornich.com/framework/Router.php:197 #3 Router:run in /home/kornich/htdocs/kornich.com/framework/Thonem.php:195 #2 Thonem:run in /home/kornich/htdocs/kornich.com/framework/Request.php:50 #1 Request:run in /home/kornich/htdocs/kornich.com/Bootstrap.php:97 #0 require_once in /home/kornich/htdocs/kornich.com/index.php:12
Stack frames (9)
8
Exception
/framework/Response.php:431
7
Response compileTemplateWithLayout
/framework/Response.php:321
6
Response render
/modules/realestate/controllers/Search.php:62
5
Search index
/framework/Router.php:241
4
Router detect
/framework/Router.php:197
3
Router run
/framework/Thonem.php:195
2
Thonem run
/framework/Request.php:50
1
Request run
/Bootstrap.php:97
0
require_once
/index.php:12
/home/kornich/htdocs/kornich.com/framework/Response.php
            throw new \Exception("Template not found: $path");
        }
 
        $content = file_get_contents($templatePath);
        $content = str_replace("__DIR__", '"' . dirname($templatePath) . '"', $content);
 
        self::ensureDirectories([dirname(self::$_thonem_cached_template)]);
        file_put_contents(self::$_thonem_cached_template, OutputProcessor($content));
    }
 
    /**
     * Compile template with layout
     * @param string $template
     */
    private static function compileTemplateWithLayout(string $template): void
    {
        $templatePath = self::getTemplate($template, self::$interface);
 
        if (!file_exists($templatePath)) {
            throw new \Exception("Template not found: $template");
        }
 
        $layoutPath = self::getTemplate("layout/" . self::$layout, self::$interface);
        $templateContent = file_get_contents($templatePath);
 
        $content = file_exists($layoutPath)
            ? str_replace('{layout}', $templateContent, file_get_contents($layoutPath))
            : $templateContent;
 
        $content = str_replace("__DIR__", '"' . dirname($templatePath) . '"', $content);
 
        self::ensureDirectories([dirname(self::$_thonem_cached_template)]);
        file_put_contents(self::$_thonem_cached_template, ($content));
    }
 
    /**
     * Render compiled template
     * @param array|null $data
     * @return string
     */
/home/kornich/htdocs/kornich.com/framework/Response.php
        if ($interface) {
            self::$interface = $interface;
        }
 
        if ($module) {
            self::$module = $module;
        }
 
        self::$_thonem_data = array_merge($data, [
            "config" => (object)\Library\Configurations::$data,
            "prop" => (object)self::$props,
            "template_folder" => self::$interface ?: "general"
        ]);
 
        $cacheKey = str_replace("/", "*", $template) . '$' . md5($template);
        self::$_thonem_cached_template = TEMPLATES_CACHE_PATH . self::$_thonem_data["template_folder"] . "/" . $cacheKey . ".template";
 
        if (!file_exists(self::$_thonem_cached_template) || DEBUG) {
            self::loadThemeAssets();
            self::compileTemplateWithLayout($template);
        }
 
        $buffer = self::renderTemplate();
 
        if ($return) {
            self::$interface = $originalInterface;
            return $buffer;
        }
 
        self::sendOutput($buffer);
 
        if (PROFILER && self::$layout !== "ajax") {
            Timeline::mark('Fully rendered');
            Debugger::render();
        }
 
        self::$interface = $originalInterface;
        return null;
    }
 
/home/kornich/htdocs/kornich.com/modules/realestate/controllers/Search.php
            "order_by" => ["properties.property_id" => "DESC"]
        ];
   
        if (get("q")) {
            $filter["grouped_or_like"]["title"] = get("q");
        }
        
        $config['url'] = url('search/index');
        $config['total'] = $model->find($filter, true);
        $config['limit'] = config('limit');
        $config['reuse_query_string'] = true;
        $config['offset'] = $offset;
        $pagination = new \Library\Pagination($config);
        $this->data['pagination'] = $pagination->create_links();
        $this->data["items"] = $model->find($filter);
        $this->data["total"] = $config['total'];
        
        $this->data["items"] = prepareProperties($this->data["items"], LANG);
        
        return \Response::render(strtolower(__CLASS__) . '/index', $this->data);
    }
 
}
 
/home/kornich/htdocs/kornich.com/framework/Router.php
 
        $controllerInstance = new $Route['controller'];
 
        // GET ACTION TO RUN (DEFAULT TO 'index' IF NOT PROVIDED)
        $method = isset($this->segments[$Route['method'] + 1]) ? $this->segments[$Route['method'] + 1] : 'index';
 
        // If the method doesn't exist, try 'index' by default
        if (!method_exists($controllerInstance, $method)) {
            if (method_exists($controllerInstance, 'index')) {
                $method = 'index';
            } else {
                \Thonem::error404();
            }
        }
 
        // GET PARAMS
        $params = array_slice($this->segments, $Route['method'] + 2, count($this->segments) - 1);
 
        // RUN THE CONTROLLER METHOD
        return $controllerInstance->{$method}(...$params);
    }
 
    /**
     * Search for the controller
     * @param $segment
     * @return array|bool
     */
    private function getController($segment = 0)
    {
        global $ThonemMap;
 
        if (count($this->segments) - 1 < $segment)
            return false;
 
        if (isset($this->segments[$segment + 1])) {
            if (isset($ThonemMap->Controller->{$this->segments[$segment] . '/' . ucfirst($this->segments[$segment + 1])})) {
                $suggestController = $ThonemMap->Controller->{$this->segments[$segment] . '/' . ucfirst($this->segments[$segment + 1])};
 
                if ($suggestController) {
                    return [
/home/kornich/htdocs/kornich.com/framework/Router.php
 
        foreach ($this->route as $pattern => $real_route) {
            // Use the built-in delimiter and avoid manually adding slashes
            $pattern = "#^" . str_replace(array_keys($this->replace), array_values($this->replace), $pattern) . "$#u";
 
            // Check if $real_route is an array or a string
            if (preg_match($pattern, $this->current, $match)) {
                if (is_array($real_route)) {
                    // If $real_route is an array, decide how to handle it (e.g., join into a string)
                    // Example: join the array into a string, or handle appropriately for your use case
                    $real_route_string = implode('/', $real_route);  // Example: You can change this logic
                    $this->segments = explode('/', preg_replace($pattern, $real_route_string, $this->current));
                } else {
                    // If $real_route is already a string, just proceed
                    $this->segments = explode('/', preg_replace($pattern, $real_route, $this->current));
                }
            }
        }
 
        return $this->detect();
    }
 
    /**
     * DETECT THE CURRENT ROUTE
     */
    public function detect()
    {
        // IT'S NOT THE DEFAULT ROUTE, FIND THE MENTIONED CONTROLLER
        $Route = $this->getController();
 
        if (isset($Route["module"]))
            define("MODULE", $Route["module"]);
        else
            define("MODULE", false);
 
        if (!$Route)
            \Thonem::error404();
 
        if (preg_match("/" . str_replace(['/', '*'], ['\\' . '/', '([a-zA-Z0-9_-]+)'], MODULES_PATH . "*/controllers/") . "/", $Route['path'], $res)) {
            \Thonem::$currentModule = $res[1];
/home/kornich/htdocs/kornich.com/framework/Thonem.php
    /**
     * Main function of the framework to run
     */
    public static function run()
    {
        if(DEBUG){
            self::add(new Debug());
        }
 
        self::add(new Loader());
 
        self::get("Loader")->boot();
 
        (new \Library\Ban())->run();
 
//        self::get("Router")->get('/blog/', 'Blog@index');
//        self::get("Router") ->post('/submit', 'FormController@submit');
//        self::get("Router")->dispatch(Request::$URI, Request::$METHOD);
 
        self::get("Router")->run();
    }
 
    public static function ao($object, $path, $default_value = null){
        foreach(explode(".", $path) as $key) {
            if(is_object($object)) {
                if(!isset($object->$key))
                    return $default_value;
                $object = $object->$key;
            }
 
            if(is_array($object)) {
                if(!isset($object[$key]))
                    return $default_value;
                $object = $object[$key];
            }
        }
        return $object;
    }
 
    public static function getMap(){
/home/kornich/htdocs/kornich.com/framework/Request.php
        // Finalize URI processing
        self::$URI = trim($uri, '/');
 
        // Set request method and headers
        self::$METHOD = $_SERVER['REQUEST_METHOD'] ?? 'GET';
        self::$HEADERS = self::getAllHeaders();
 
        // Check for maintenance mode
        if (CLOSE && !DEBUG) {
            Thonem::underMaintenance(1010);
        }
 
        // Process JSON input
        self::processJsonInput();
 
        // Load composer autoload if exists
        self::loadVendorAutoload();
 
        // Run the application
        (new \Thonem())->run();
 
        define('THONEM_END_TIME', microtime(true));
    }
 
    private static function validateHost(): void {
        if (!CLI_MODE && parse_url(URL, PHP_URL_HOST) != ($_SERVER["HTTP_HOST"] ?? '')) {
            header("location: ".URL);
            exit;
        }
    }
 
//    private static function determineUri(): string {
//        if (CLI_MODE) {
//            return $_SERVER['argv'][1] ?? '/';
//        }
//
//        // Determine routing path
//        self::$ROUTING_PATH = strtoupper($_ENV["ROUTING_PATH"] ?? '');
//
//        if (self::$ROUTING_PATH == "AUTO") {
/home/kornich/htdocs/kornich.com/Bootstrap.php
    }
});
 
try {
    if(PROFILER){
        Debugger::init();
        Timeline::mark('Bootstrap Start');
    }
 
    header_remove("Server");
    header("Server: Thonem v". VERSION);
    header("X-Powered-By: Thonem");
    header("Powered-By: Thonem");
    header("Thonem-Version:". VERSION);
    header("Thonem-Token:". rand(000000,999999));
    if(PROFILER){
        Timeline::mark('Controller Invoked');
        $_SERVER['REQUEST_TIME_FLOAT'] = microtime(true);
    }
    Request::run();
 
} catch (Exception $e) {
    $error = [
        "message" => $e->getMessage(),
        "file" => $e->getFile(),
        "line" => $e->getLine(),
        "code" => $e->getCode(),
        "trace" => $e->getTrace()
    ];
 
    if (DEBUG) {
        if(PROFILER)
        Debugger::addPanel(new ErrorPanel());
        $prettyHandler = new Whoops\Handler\PrettyPageHandler();
        $whoops = new \Whoops\Run;
        $whoops->allowQuit(false);
        $whoops->writeToOutput(false);
        $whoops->pushHandler(function ($e, $inspector, $run) {
            if(PROFILER)
            ErrorPanel::capture($e);
/home/kornich/htdocs/kornich.com/index.php
<?php
 
declare(strict_types=1);
 
if(isset($_SERVER['REQUEST_URI'])) {
    $clean_uri = strtok($_SERVER['REQUEST_URI'], '?');
    $_SERVER['REQUEST_URI'] = $clean_uri;
}
 
define("THONEM_IDX", __DIR__.'/');
 
require_once __DIR__."/Bootstrap.php";

Environment & details:

Key Value
user_id 938
empty
empty
empty
empty
Key Value
USER kornich
HOME /home/kornich
HTTP_X_FORWARDED_PROTO https
HTTP_CF_VISITOR {"scheme":"https"}
HTTP_CF_IPCOUNTRY US
HTTP_CF_CONNECTING_IP 216.73.216.136
HTTP_CDN_LOOP cloudflare; loops=1
HTTP_USER_AGENT Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; [email protected])
HTTP_ACCEPT_ENCODING gzip, br
HTTP_ACCEPT */*
HTTP_CF_RAY 96f76c32d9a3a1f8-YYZ
HTTP_CONNECTION close
HTTP_X_FORWARDED_FOR 216.73.216.136, 108.162.241.166
HTTP_X_REAL_IP 108.162.241.166
HTTP_X_FORWARDED_HOST kornich.com
PHP_VALUE error_log=/home/kornich/logs/php/error.log; memory_limit=1G; max_execution_time=120; max_input_time=60; max_input_vars=10000; post_max_size=64M; upload_max_filesize=64M; date.timezone=UTC; display_errors=off;
HTTPS on
MGT 1
GEOIP_LONGITUDE -79.7616
GEOIP_LATITUDE 43.6885
GEOIP_CITY_CONTINENT_CODE NA
GEOIP_POSTAL_CODE
GEOIP_CITY Brampton
GEOIP_REGION ON
GEOIP_CITY_COUNTRY_NAME Canada
GEOIP_CITY_COUNTRY_CODE3 CAN
GEOIP_CITY_COUNTRY_CODE CA
GEOIP_COUNTRY_NAME Canada
GEOIP_COUNTRY_CODE3 CAN
GEOIP_COUNTRY_CODE CA
REDIRECT_STATUS 200
HTTP_HOST kornich.com
SERVER_NAME kornich.com
SERVER_PORT 443
SERVER_ADDR 127.0.0.1
REMOTE_PORT
REMOTE_ADDR 216.73.216.136
SERVER_SOFTWARE nginx/1.28.0
GATEWAY_INTERFACE CGI/1.1
SERVER_PROTOCOL HTTP/1.0
DOCUMENT_ROOT /home/kornich/htdocs/kornich.com
DOCUMENT_URI /index.php
REQUEST_URI /en/search/index/0
SCRIPT_NAME /index.php
SCRIPT_FILENAME /home/kornich/htdocs/kornich.com/index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING user_id=938
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1755247598.6031
REQUEST_TIME 1755247598
Key Value
URL https://kornich.com/
DEBUG 1
DEBUG_SECRET KORNICH$$
CONFIG_SECRET THONEMSECRETSSS((*&^^)
DEMO
CRONJOB 1
MULTI_LANGUAGE 1
ASSETS_CACHE
PROFILER
PROFILER_SECRET THONEM
PROFILER_LOG 1
PROFILER_PRINT 1
DEFAULT_LANGUAGE en
SESSION_NAME THONEM
ENCRYPTION_KEY
IKEY
TIMEZONE Africa/Cairo
CLOSE
ROUTING_PATH REQUEST_URI
TOKEN token
WEBSOCKET_ENABLED
WEBSOCKET_SECURED
WEBSOCKET_PORT 9999
WEBSOCKET_HOST ws://localhost
DATABASE_HOSTNAME localhost
DATABASE_USERNAME kornich-thonem
DATABASE_PASSWORD kornich-thonem##
DATABASE_NAME kornich-thonem
DATABASE_DRIVER mysql
DATABASE_CHARSET utf8
CSRF_SECRET_KEY "8c81e70afdwer7ac6ec439180572f71998369388d0670a879fa018372689c6e4b7e00bdf2b7560bbbb6ac5c382790c223fa6bb2c1be0a6390c7470c6e1d348dca"
CSRF_TOKEN_LIFETIME 30 * 60
COMPRESS_OUTPUT 1
LANG en
0. Whoops\Handler\CallbackHandler
1. Whoops\Handler\PrettyPageHandler