Welcome Guest, Not a member yet? Register   Sign In
No input file specified.
#1

(This post was last modified: 03-26-2022, 11:56 AM by inversia.)

Hello!
I get this error [b]No input file sNo input file specified.[/b]

URL

https://site/index.php/pages

or

https://site/pages

or

https://site/main


app/Controllers/Pages.php

PHP Code:
<?php

namespace App\Controllers;

class 
Pages extends BaseController
{
    public function index()
    {
        return view('default');
    }

    public function view($page 'main')
    {
        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);
    }


Routes.php

PHP Code:
$routes->get('/''Home::index');

$routes->get('(:any)''Pages::view/$1'); 


Folder structure

Views/pages/main.php
Views/templates/header.php
Views/templates/footer.php
Views/default.php
Views/home.php


What could be the reason?

P.S.
did everything according to this instruction

https://codeigniter.com/user_guide/tutor...pages.html#
Reply
#2

(This post was last modified: 03-31-2022, 05:50 PM by kenjis.)

Did you do this?
https://codeigniter.com/user_guide/tutor...ng-the-app

This topic might help you.
https://forum.codeigniter.com/showthread.php?tid=77365
Reply
#3

(03-31-2022, 05:49 PM)kenjis Wrote: Did you do this?
https://codeigniter.com/user_guide/tutor...ng-the-app

This topic might help you.
https://forum.codeigniter.com/showthread.php?tid=77365

https://codeigniter.com/user_guide/tutor...ng-the-app
I can't run this command because I have shared hosting

> php spark serve

https://forum.codeigniter.com/showthread.php?tid=77365
Yes, I read it, but unfortunately it didn't help.


Here is a link
site/public/index.php/pages/view/main
that eventually worked, but now I don’t remember how to set up links like
site/pages/main
Reply




Theme © iAndrew 2016 - Forum software by © MyBB