Server Requirements
Relevant source files
The following files were used as context for generating this wiki page:This document outlines the server-side requirements and architecture for the Institute Itech website. The backend is a PHP-based application responsible for rendering dynamic pages, handling internationalization through session management, and serving static assets. The architecture follows a simple file-based routing pattern where individual PHP scripts serve as entry points for different sections of the website.
Core Technology
The server-side logic is implemented in PHP. The application relies on a standard PHP environment capable of executing scripts and managing user sessions. Session management is initiated at the beginning of each page request using session_start().
Sources: iite/overview.php:2, iite/wep.php:2, iite/relationship.php:2
Page Rendering and Routing
The website does not use a centralized routing framework. Instead, it employs a direct file-based routing system where a specific URL path maps directly to a PHP file on the server. These PHP scripts act as simple controllers that handle request logic (like language selection) and then include a corresponding .phtml template file to generate the final HTML output.
Sources: iite/overview.php, research/overview.php, inside/overview.php
Request Handling Flow
The following diagram illustrates the typical server-side process for handling a page request.
This diagram shows the sequence of operations within a PHP entry point, from session initialization to final HTML rendering.
Sources: iite/overview.php:2-20, apps/pages.php
Key PHP Entry Points
The application is structured around several primary PHP files that serve as the main entry points for different pages.
| File Path | Included Template | Page Title Source |
|---|---|---|
iite/overview.php | themes/apps/iite/overview.phtml | iite_overview key in apps/pages.php |
iite/wep.php | themes/apps/iite/wep.phtml | iite_wep key in apps/pages.php |
iite/relationship.php | themes/apps/iite/relationship.phtml | iite_relationship key in apps/pages.php |
inside/overview.php | themes/apps/inside/overview.phtml | inside_ets key in apps/pages.php |
research/overview.php | themes/apps/research/overview.phtml | Not specified, falls back to layout. |
Sources: iite/overview.php:19-21, iite/wep.php:19-21, iite/relationship.php:18-20, inside/overview.php:19-21, research/overview.php:7-9, apps/pages.php:10-29
A typical entry point script follows this pattern:
<?php
session_start();
if (isset($_GET['lang'])) {
$_SESSION['lang'] = $_GET['lang'];
$cleanUrl = strtok($_SERVER["REQUEST_URI"], '?');
header("Location: $cleanUrl");
exit;
}
$lang = $_SESSION['lang'] ?? 'it';
$page = $_GET['page'] ?? 'iite_overview';
$translations = require __DIR__ . '/../apps/pages.php';
$title = $translations[$page][$lang] ?? $translations[$page]['en'] ?? 'Institute Itech';
function t($key) {
// ... translation logic
}
ob_start();
include __DIR__ . '/../themes/apps/iite/overview.phtml';
$output_page = ob_get_clean();
include __DIR__ . '/../themes/components/statics/layout.phtml';
Source: iite/overview.php:1-22
Internationalization (i18n)
The server manages content language through PHP sessions. The language can be changed by providing a lang query parameter in the URL.
Language Selection Flow
- A user requests a page with a
?lang=<code>parameter (e.g.,?lang=en). - The server-side PHP script detects the
langparameter. - The selected language code is stored in the
$_SESSION['lang']variable. - The server redirects the user to the same URL without the query parameter to provide a clean URL.
- On subsequent requests, the language is read from the session. The default language is Italian (
it).
Sources: iite/overview.php:4-9, iite/wep.php:4-9
The following sequence diagram shows the language switching process.
This diagram details how the server handles a language change request and uses sessions for persistence.
Source: iite/overview.php:4-13
Translation Sources
Translations are sourced from two main files:
apps/pages.php: An associative array containing page titles for different languages.apps/translations.json: A JSON file containing UI strings for various components like the hero section, navigation, and cookie consent banner.
The t($key) function is used within the templates to retrieve the correct string based on the active language.
Sources: apps/pages.php, apps/translations.json, iite/overview.php:15-18
Static Asset Serving
The web server must be configured to serve static files from specific directories. These assets include stylesheets, JavaScript files, and images.
Asset Directory Structure
The primary directories for static assets are located under the project root.
This diagram shows the main directories from which the server needs to serve static content.
Sources: themes/css/design.css:135, 608, themes/css/iite.css:1, apps/js/iite_components.js
Expected URL Paths
The client-side JavaScript defines the expected navigation paths that the server must handle. These paths correspond to the PHP entry points.
Client-Side data-page | Server-Side Path |
|---|---|
iite | / (or http://localhost) |
insideiite | /inside/overview.php |
departments | /departments/overview.php |
research | # (No server path defined) |
news | # (No server path defined) |
inside | # (No server path defined) |
Source: apps/js/iite_components.js:7-19
Summary
The server for the oldwebsite project is a straightforward PHP application. Its main responsibilities are to handle file-based routing, manage user language preferences via sessions, and render HTML by combining PHP logic with .phtml templates. The server must also be configured to correctly serve static assets such as CSS, JavaScript, and images from the /themes and /apps directories.