-
Notifications
You must be signed in to change notification settings - Fork 0
Routing and Rendering
most pages are folder routes:
-
/feed->feed/index.php+feed/content.html -
/journal/posts/12->journal/posts/index.php -
/settings->settings/index.php+settings/content.html
static error pages are the main exception:
error/403/index.htmlerror/404/index.htmlerror/50x/index.htmlerror/wip/index.html
most PHP routes define a local find_template_file() helper that walks up parent directories until it finds a requested file.
that means nested routes can still find:
template.htmltemplate_mobile.htmlcontent.htmllib/render.php- root-level assets or data paths
admin account pages use equivalent helpers in account/admin/helpers.php.
typical route flow:
- start session through
fridg3_start_session()fromlib/session.php - optionally enforce auth/admin checks
- load render helper from
lib/render.php - choose template with
get_preferred_template_name(__DIR__) - load local
content.html - inject placeholders like
{content},{title},{description},{user_greeting} - optionally swap account footer button to logout when logged in
theme selection also runs through lib/render.php. desktop requests can use a theme HTML template from /themes/lib; mobile requests always keep template_mobile.html and append the selected theme CSS after the mobile inline styles.
some routes also pull in extra shared libs like lib/feed.php for route-specific persistence helpers instead of keeping all that logic inline.
root index.php is more dynamic than the wrapper routes.
it injects:
- latest feed post from
data/feed/*.txt - latest journal post from
data/journal/*.txt - up to 3 music cards from
data/music/frdg3/*.json
it also contains older bookmark-loading logic that still points at /data/users, which is legacy behavior and worth keeping an eye on.
wrapper routes are mostly just shell + static content:
discord/merch/- parts of
others/
data-backed routes do real work:
feed/journal/guestbook/bookmarks/contact/music/gallery/account/*api/*
maintenance mode is driven by data/etc/wip.
main.js:
- loads the flag
- shows the maintenance banner
- redirects non-admins to
/error/wip - allows
/account/loginand/error/wip
the admin bypass depends on either:
-
is_admincookie /api/account/is-admin
page views are not baked in by PHP. the footer view count is hydrated by main.js, which posts the current path to /api/page-view.