• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pager Error Invalid file: Pagers(slash)bs_full.php

#11
(02-23-2021, 12:49 AM)kenjis Wrote:
(02-23-2021, 12:24 AM)Corsari Wrote: Maybe CodeIgniter exception feedback for these cases could be written somehow less cryptic or with a more explicit complain
It is true.
But how do we improve it?

CI shows:
Quote:Invalid file: Pagers\bs_full.php
This shows bs_full.php in the namespace Pagers is invalid.

Any idea?

I see

Instead of "invalid file" could be
"namespace path not found"

Or even explicit

"something in namespace /Pagers is wrong"

in such a way that makes you think about a path and not a file (in this case)

Though, "invalid" takes you on a wrong road , because the file itself works fine in another host
Reply

#12
Thank you for your idea.

I still do not understand why in your local it worked.
Probably you don't have Pagers namespace.
Reply

#13
(02-22-2021, 04:08 PM)kenjis Wrote: Try.
PHP Code:
        public $templates = [
                ...
                'bs_full'   => 'App\Views\Pager\bs_full',
                'bs_simple' => 'App\Views\Pager\bs_simple',
    ]; 

(02-23-2021, 01:10 AM)kenjis Wrote: Thank you for your idea.

I still do not understand why in your local it worked.
Probably you don't have Pagers namespace.


Probably you don't have Pagers namespace. <--- hello! thank you for your kind help .. where do you mean it is missing that namespace?

Just to check/fix it
Reply

#14
Your problem is this the bs_full.php is looking in the Pager folder but you have named it Pagers

Make sure that the Pager file paths match the folder paths.

Rename the Pagers folder to Pager and it should work.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply

#15
(02-23-2021, 02:10 AM)InsiteFX Wrote: Your problem is this the bs_full.php is looking in the Pager folder but you have named it Pagers

Make sure that the Pager file paths match the folder paths.

Rename the Pagers folder to Pager and it should work.

hello InsiteFX
I tried this to give you some feedback ("Make sure that the Pager file paths match the folder paths." <--- though it was anyway matching since Pagers was the directory and Pagers was written inside the Pager.php config file, anyway going on..)

- renamed directory Pagers to Pager
- changed Pager.php in \App\Config to this code:

PHP Code:
    public $templates = [
        
'default_full'   => 'CodeIgniter\Pager\Views\default_full',
        
'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
        
'default_head'   => 'CodeIgniter\Pager\Views\default_head',
        
'bs_full'        => 'Pager\bs_full',
        
'bs_simple'      => 'Pager\bs_simple',
    ]; 


same exception error, so at the moment I revert it back to Kenjis suggestion
Reply

#16
(02-23-2021, 01:26 AM)Corsari Wrote: Probably you don't have Pagers namespace. <--- hello! thank you for your kind help .. where do you mean it is missing that namespace?

Just to check/fix it

I don't mean you missed namespace setting.
I mean it is strange that you don't set the namespace but it works on your local.

First of all, a view file is not a class file. So it is not PHP's real namespace.
But CI4 provides as if it is namespaced.
See https://codeigniter4.github.io/CodeIgnit...aced-views

And the default app namespace is `App`, and its directory is app.
So if you have app/Views/Pagers/bs_full.php, it is stated as `App\Views\Pagers\bs_full`.

If you want to write `Pagers\bs_full`, you also have to set the namespace `Pagers`.
And in that case, probably you want to have Pagers module.

If you really want to set namespace,
see https://codeigniter4.github.io/CodeIgnit...namespaces
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.