What is the relationship between the CMS and the landing page?

Comments for “What is the relationship between the CMS and the landing page?”

Posted by Josh1985 on Saturday 27th January 2024 at 05:13 GMT

Hello all!

I have perhaps a stupid question, but thought I would ask anyway...

A little background as to where this question comes from: I haven't seen a video from DC or documentation that I am aware of, that explains in any real way, how the CMS works in relation to the default welcome/landing page.

What I mean by that is: how does the pages you create in the content management system relate to the landing page you get when you first create a Trongate app?

Also, how are they accessible in public view?

For example, if you create a "home" page through the CMS, how would you link to that page or set it up to be the TRUE home page without breaking the landing page or CMS?

Would that still have to hard-coded through a controller and view module or would you do that some other way?

Thanks all!


User Level: Guest

Date Joined: 13/09/2022

Posted by DaFa on Saturday 27th January 2024 at 11:38 GMT

Hi Josh, be reassured there are no silly questions around here.

Put simply, the default landing page is not related to the CMS. As you would be aware, you define the default landing page in 'config.php', like so:
define('DEFAULT_MODULE', 'welcome');
define('DEFAULT_CONTROLLER', 'Welcome');
define('DEFAULT_METHOD', 'index');
define('MODULE_ASSETS_TRIGGER', '_module');
define('INTERCEPT_404', 'trongate_pages/attempt_display');
You may also notice the last define, where an intercept page is being pointed to the method 'attempt_display' in the Trongate_pages controller. This will allow you to give any name you like to segments 1, 2, 3, etc... as long as the last segment is a valid url_srtring of a page you have created in Trongate Pages and you have published it. For example: you have created a page called 'First Page' and you publish it. You can view the page by going to
however, you can also view it like so
Obviously, the second example is ridiculous, but I hope you get my drift.

So to sum up, you can edit your config.php to point to your home page created in the CMS (Trongate Pages) and not alter the default welcome page - however, on a live site, you would remove the welcome module if you are not using it or an easier way would be to change the index method in the Welcome controller to:
function index(): void {
	redirect(BASE_URL . 'home/first-page');

On a side note, please read through the code of 'attempt_display' as it also deals with user status, edit mode and ENV.

I hope that helps 👍

This comment was edited by DaFa on Saturday 27th January 2024 at 11:46 GMT

Founding Member


User Level: Founding Member

Date Joined: 30/11/2018

Posted by Josh1985 on Thursday 1st February 2024 at 15:50 GMT

Thanks for your response DaFa!

A few follow-up questions:

1.) You say that the landing page and the CMS are not related. If I were to say delete the welcome module after redirecting Trongate to a new "home" page, would that not remove the ability to easily interface with the admin section and thereby the CMS? I ask this because as I understand it, the Welcome Module is the very thing responsible for allowing an interface to be available to the dev to login admin side and use the CMS easily, correct?

2.) Assuming I am right about question #1, I would think it would be possible to just add a hyperlink to the admin side on any new "home" page that Trongate is redirected to through the config file you mentioned, correct? Although I know this might not be what you would want on a "live" site.

3.) If we are to "hide" the admin side from view on a "live" site, how do we do that without directly linking to it from the home page and/or other pages in a site and still make it accessible? I ask this because I have always heard you should never have your admin login visible from a "live" public page...

Thank you again!

This comment was edited by Josh1985 on Thursday 1st February 2024 at 15:55 GMT


User Level: Guest

Date Joined: 13/09/2022

Posted by Dom on Thursday 1st February 2024 at 19:17 GMT

Hi Josh

I'm anything but an expert in this but I can at least answer questions 1 and 2 for you.

1) Deleting the welcome module will indeed remove direct access to admin panel as it currently stands assuming that you wanted a 'visible' link in the form of something like a button through which you would access it.

However you could just type type tg-admin into the address bar after your base url and you'd be directed to the admin login page.

That sort of answers your question three, and if you wanted something visual on whatever 'landing page' you eventually chose to have you would just need to add something like this somewhere;

    echo anchor('tg-admin', 'Admin Panel', array('class' => 'button'));

Hope that helps.
Level One Member


User Level: Level One Member

Date Joined: 12/01/2024

Posted by DaFa on Thursday 1st February 2024 at 22:20 GMT

Hi Josh, I must have missed your follow-up questions, and thanks Dom for your input too.

1. The default landing page ('BASE_URL'welcome/index) is defined in 'config.php' It is there as a 'template' for you as the developer to have something to start with. You can change it to anything you want. You can replace it with whatever you like. Don't get caught up in 'closed boxes' be creative and use it or create what works for you. Some ideas would be to add an IF statement checking if the ENV variable is in 'dev' mode and only display links and 'dev-tools' you want available while you are developing your app and as soon as you make it 'live' these tools are no longer displayed and more importantly disabled from being reached via the URL.
To take Dom's example further, here is a modified snippet from the welcome.php view that will hide the admin link if ENV is anything other than 'dev':
if (ENV === 'dev') {
    echo anchor('tg-admin', 'Admin Panel', array('class' => 'button'));
echo anchor('https://trongate.io/learning-zone', 'Learning Zone', array('class' => 'button alt'));

2 & 3. This relates to what was mentioned above. Remember to remove all links to your admin panel from pages when going live. You should also create a secret URL that you and your client have to get to your admin panel. Remove any default links or custom routes from your site, like tg-admin.
This is the custom routes array I was referring to:
$routes = [
    'tg-admin' => 'trongate_administrators/login',
    'tg-admin/submit_login' => 'trongate_administrators/submit_login',
    'trongate-pages' => 'trongate_pages/index'

Please also remember to close this thread (and others you have opened) if you feel your question(s) have been answered.

Happy Coding!

This comment was edited by DaFa on Thursday 1st February 2024 at 22:48 GMT

Founding Member


User Level: Founding Member

Date Joined: 30/11/2018