Introduction
Quick Start
Basic Concepts
Understanding Routing
Intercepting Requests
Module Fundamentals
Database Operations
Templates
Helpers
Form Handling
Form Validation
Working With Files
Image Manipulation
Working With Dates & Times
Language Control
Security
Custom 404 Pages
Trongate has always made 404 pages dead simple. In v2 it's even cleaner.
The Single Source of Truth
Open this file →
And you'll find this line →
When a URL cannot be matched, Trongate automatically calls →
The above code simply loads this view →
It uses the exact same mechanism as admin() and public().
Three Ways to Customize Your 404 Pages
Option 1 – Quick & Easy (most common)
Just edit the existing file →
Make it friendly, funny, or brutally honest – your call.
Option 2 – Use a Different View in the templates Module
Add a new method to this file →
Create this view →
Then change the constant →
Option 3 – Point to Any Module/Method You Like
Want a completely custom 404 page with extra logic? Point the constant anywhere →
Trongate will automatically call that module and method.
Real-World Example (Simple & Clean)
Here's a tidy, beginner-friendly custom 404 that still feels professional →
Then, from within modules/errors/Errors.php:
You can, of course, make it as fancy as you like later – add logging, suggested pages, a search box – but the pattern is always the same: one constant, one method, one template.
One line in config.php → total control over every 404.
No hooks, no events, no middleware. Just Native PHP doing what it does best.
Congratulations! You now know everything there is to know about templates in Trongate v2.
Go build something beautiful.
We're continually improving the Trongate documentation. If anything is incorrect, unclear, incomplete, or could be better, we'd genuinely appreciate your input.
Share your thoughts in the Documentation Feedback.