Welcome Guest, Not a member yet? Register   Sign In
help, cannot get "Static Pages" to work from the user guide :(
#1
Question 

I am working with the CI4 user guide.  I'm beginning to see how things are routed, etc.  However, I cannot seem to get the static page(s) to work.  I followed the guide precisely as far as I can tell, but I get: "No input file specified" no matter what URL I select (except for the home page, as that loads the default Ci4 page, so I know everything is installed correctly, I assume).  I am using everything on a live server with Apache, Ubunto 16, and PHP 7.3 and Plesk Obsidian.  Here's my controller:

Code:
<?php namespace App\Controllers;

use CodeIgniter\Controller;

class Pages extends Controller
{
    public function index()
    {
        return view('welcome_message');
    }

    public function view($page = 'home')
    {
        if ( ! is_file(APPPATH.'/Views/pages/'.$page.'.php'))
        {
        // Whoops, we don't have a page for that!
            throw new \CodeIgniter\Exceptions\PageNotFoundException($page);
        }

        $data['title'] = ucfirst($page); // Capitalize the first letter

        echo view('templates/header', $data);
        echo view('pages/'.$page, $data);
        echo view('templates/footer', $data);
    }
}

And then I have the source files under: app/Views/pages and app/Views/templates

But I can't make heads or tails of it.  Help please! Thanks!
Reply


Messages In This Thread
help, cannot get "Static Pages" to work from the user guide :( - by zoldos - 08-18-2020, 05:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB