From 68fc9e55e538e03f94509731ab41a0c8cf96710f Mon Sep 17 00:00:00 2001 From: George Halkiadakis Date: Mon, 17 Apr 2023 12:12:22 +0300 Subject: setup a real server environment (apache DocumentRoot=/var/www/public) --- public/app/controllers/Resolve.php | 91 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 public/app/controllers/Resolve.php (limited to 'public/app/controllers/Resolve.php') diff --git a/public/app/controllers/Resolve.php b/public/app/controllers/Resolve.php new file mode 100644 index 0000000..7b9222c --- /dev/null +++ b/public/app/controllers/Resolve.php @@ -0,0 +1,91 @@ + [ + 'title' => $page['Title'], + 'seo' => [], + 'sections' => [ + [ + 'view' => 'content/static', + 'key' => 'page', + 'data' => $page + ] + ] + ] + ]); + return ; + } + + + if (!PRODUCTION) Benchmark::add_spot('proxy-category'); + + // proxying check if products category with this url + $category = proxy( + [\app\models\market\ProductCategories_model::class, 'categoryFromUrl'], + [ $fullUrl ], CACHE_CATEGORY_TTL + ); + // if category exist, construct category + if ($category !== false) { + // render page + load_template('products', [ 'data' => [ + 'title' => $category['Title'], + 'seo' => [], + 'tree' => proxy( + [\app\models\market\ProductCategories_model::class, 'tree'], + [], CACHE_ROOT_TTL + ), + 'hierarchyPath' => explode('.', substr($category['Hierarchy'], 1, -1)), + 'sections' => [ + [ + 'view' => 'content/product_list/Product_List_Filters', + 'key' => 'filters', + 'data' => $category + ], + [ + 'view' => 'content/product_list/product_list', + 'key' => 'products', + 'data' => $category['products'] + ] + ] + ] + ]); + return ; + } + + + // not page nor category?: reply 404 + header("HTTP/1.0 404 Not Found"); + render_view('error/404', ['message' => 'Say something I\'m givin\' up on you.']); + + } + +} \ No newline at end of file -- cgit v1.2.3