CodeIgniter Forums
Error in the CodeIgniter 4 Tutorial - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forum-30.html)
+--- Thread: Error in the CodeIgniter 4 Tutorial (/thread-73050.html)



Error in the CodeIgniter 4 Tutorial - InsiteFX - 03-13-2019

In the Static Page controller.

You have the route as this:
PHP Code:
$routes->get('(:any)''Pages::showme/$1'); 

But when you get to the News Section Create News item.

You have the routes like this:
PHP Code:
$routes->match(['get''post'], 'news/create''News::create');
$routes->get('news/(:segment)''News::view/$1');
$routes->get('news''News::index');
$routes->get('(:any)''Pages::view/$1'); 

See the Pages route, should be:
PHP Code:
$routes->get('(:any)''Pages::showme/$1'); 

Thanks.


RE: Error in the CodeIgniter 4 Tutorial - devops - 03-13-2019

Also in Accessing Config Files:
Code:
// Creating new class by hand
$config = new \Config\Pager();

// Creating new class with config function
$config = config( 'Pager', false );

// Get shared instance with config function
$config = config( 'Pager' );

// Access config class with namespace
$config = config( 'Config\\Pager' );

// Access settings as class properties
$pageSize = $pager->perPage;

Should be more like:
Code:
// Creating new class by hand
$pager= new \Config\Pager();

// Creating new class with config function
$pager= config( 'Pager', false );

// Get shared instance with config function
$pager= config( 'Pager' );

// Access config class with namespace
$pager= config( 'Config\\Pager' );

// Access settings as class properties
$pageSize = $pager->perPage;



RE: Error in the CodeIgniter 4 Tutorial - ciadmin - 03-14-2019

@InsiteFX good catch, thanks. fixing.

@devops It is actually the last line in the sample code that needs fixing ... $pageDize = $config->perPage; fixing.