Introduction
Basic Concepts
Understanding Routing
Controllers
Views
Assets
Modules Calling Modules
Parent & Child Modules
Database Operations
Modules within Modules
Templates & Themes
Helpers Explained
Form Handling
Working with Files
The Module Import Wizard
Authorization & Authentication
The API Explorer
If you’ve found an error, spotted something missing, or feel a section could be clearer or better explained, we’d love to hear from you. Your feedback helps keep the documentation accurate and useful for everyone.
Please report issues or suggest improvements on GitHub. Community input is invaluable in making the docs stronger.
Not comfortable with GitHub? No problem — you can also get in touch with us directly via our contact form. We welcome all feedback.
Homepage Routing
The homepage is often the most visited page of any website. Trongate provides a simple way to control what happens when users visit your website's homepage (the root URL of your site).
Homepage Configuration
Homepage routing in Trongate is controlled through three constants in your config.php
file, which is located in the 'config' directory. Here are the default settings:
These three constants work together to determine what code runs when someone visits your homepage:
- DEFAULT_MODULE: The module folder where your code is located
- DEFAULT_CONTROLLER: The controller file that contains your code
- DEFAULT_METHOD: The specific function that will run
With these default settings, visiting your homepage will:
- Look inside the 'welcome' module folder
- Find the 'Welcome' controller file
- Run the 'index' method inside that controller
In web development, the URL that maps to the homepage of an application is often referred to as the base URL. In Trongate, the base URL is declared, inside 'config.php', through a PHP constant named as BASE_URL
. The last character of your base URL should always be a forwardslash.
Here's the contents of the config.php file that is being used for the this website (yes, really!):
Customizing Your Homepage
You can change what appears on your homepage by modifying the constants within config.php. This file is located in:
Example
For example, if you want your homepage to display a dashboard, you might use:
Important: Before changing these settings, make sure:
- Your module folder exists
- Your controller file exists inside the module folder
- Your method exists inside the controller
Otherwise, users will see an error when they visit your homepage.