1056

open new app get 404 error : page not found

Comments for “open new app get 404 error : page not found”
 

Posted by Guest VHJZSR on Saturday 5th August 2023 at 15:53 GMT

Howdy All, fitted the typeerror with alter user root password in mysql,
Now new issue when opening new App, get 404 error : page not found ??
config.php and dataabase.php look correct, added setup.sql to app created in phpmyadmin, so not understanding why getting 404 error page. Looking for ideas, Thank you!

http://127.0.0.1/family_store/public/

This comment was edited by Guest VHJZSR on Monday 7th August 2023 at 10:30 GMT

Level One Member

Guest VHJZSR

User Level: Level One Member

Date Joined: 5/08/2023

Posted by djnordeen on Saturday 5th August 2023 at 17:10 GMT

Well, we need some more info.
What does it say in the address bar when you get the error?
Early Adopter

djnordeen

User Level: Early Adopter

Date Joined: 20/08/2021

Posted by Guest VHJZSR on Monday 7th August 2023 at 10:58 GMT

when I go to http://127.0.0.1/family_store/,
I select the public folder and get the 404.php page (red)
title bar shows: http://127.0.0.1/family_store/public/
Level One Member

Guest VHJZSR

User Level: Level One Member

Date Joined: 5/08/2023

Posted by DaFa on Monday 7th August 2023 at 11:30 GMT

G'day VHJZSR,

That is normal behaviour for that URL - you need to call a valid module/ method like your default controller - the public folder is more for assets (css, js images, etc...) not pages to view

http://127.0.0.1/family_store/

is the same as

http://127.0.0.1/family_store/welcome
or
http://127.0.0.1/family_store/welcome/index

Your config file defines this for you
define('DEFAULT_CONTROLLER', 'Welcome');
define('DEFAULT_METHOD', 'index');


When you create a custom module like:
modules/test/controllers/Test.php
<?php
class Test extends Trongate {

    function index() {
        $data['view_module'] = 'test';

        $data['view_file'] = 'display';
        $this->template('public', $data);
    }
}

and the view
modules/test/views/display.php
<h1>Hello from <span><i>test</i></span> module</h1>
    <p>This view was generated using Trongate Scaffold & Code Snippets!</p>
        <div>
            <a href="https://github.com/jakecastelli/trongate-vscode" target="_blank">Keep updated here
            </a>
        </div>
    
        <div>
            <a href="https://trongate.io/" target="_blank">Trongate</a>
        </div>
<style>
    /* Link to the test/assets/css/custom.css */
    @import url('<?= BASE_URL ?>test_module/css/custom.css');

    body {
        background-color: rgb(251, 178, 165);
    }
</style>

<!-- Link to the assets/js/custom.js -->
<script src="<?= BASE_URL ?>test_module/js/custom.js"></script>

the URL to view this would be:
http://127.0.0.1/family_store/test or http://127.0.0.1/family_store/test/index

NOTE: the above module was created with the Trongate VSCode extension which you can get from: https://marketplace.visualstudio.com/search?term=trongate&target=VSCode&category=All%20categories&sortBy=Relevance

I would suggest you read up on the basics of modules, controllers and views

https://trongate.io/docs/information/what-is-a-controller
https://trongate.io/docs/information/understanding-view-files

This comment was edited by DaFa on Monday 7th August 2023 at 11:39 GMT

Founding Member

DaFa

User Level: Founding Member

Date Joined: 30/11/2018

×