Welcome Guest, Not a member yet? Register   Sign In
Please Help with routing
#3

(This post was last modified: 11-04-2020, 02:06 AM by captain-sensible.)

reading the docs will explain everything thats true, but a little guidance to get you in the right direction .We all need a little help :^)


At some point there will be updates and probably updates for additional software you don't know of yet and don't think you need when you do its going to be easier with composer. So i would say give https://getcomposer.org/ a good read first.

There are options for CI4 , my preference is for appstarter which you can install using composer.

I have a core appstarter called basic to play with some concepts i'm learning. When you use a command terminal and cd say to Desktop and use this command:

Code:
composer  create-project codeigniter4/appstarter --no-dev
you should get a directory called appstarter. For you its going to be something like

Code:
php composer.phar create-project codeigniter4/appstarter --no-dev
//you will have to play with concepts of using composer locally and globally . I renamed mine to "basic" lets have a look:




Code:
basic
├── README.md
├── app
│   ├── Common.php
│   ├── Config
│   ├── Controllers
│   ├── Database
│   ├── Entities
│   ├── Filters
│   ├── Helpers
│   ├── Language
│   ├── Libraries
│   ├── Models
│   ├── ThirdParty
│   ├── Views
│   └── index.html
├── builds
├── composer.json
├── composer.lock
├── env
├── license.txt
├── phpunit.xml.dist
├── public
│   ├── captcha
│   ├── css
│   ├── errors
│   ├── favicon.ico
│   ├── fonts
│   ├── images
│   ├── index.php
│   ├── js
│   ├── minCss
│   ├── portfolio
│   ├── robots.txt
│   └── sounds
├── spark
├── tests
│   ├── README.md
│   ├── _support
│   ├── database
│   ├── session
│   └── unit
├── vendor
│   ├── autoload.php
│   ├── bin
│   ├── codeigniter4
│   ├── composer
│   ├── doctrine
│   ├── fzaninotto
│   ├── kint-php
│   ├── laminas
│   ├── mikey179
│   ├── myclabs
│   ├── phar-io
│   ├── phpdocumentor
│   ├── phpspec
│   ├── phpunit
│   ├── psr
│   ├── sebastian
│   ├── symfony
│   ├── theseer
│   └── webmozart
└── writable
    ├── Art2
    ├── Art22
    ├── cache
    ├── debugbar
    ├── logs
    ├── session
    └── uploads

your controllers go in contollers, views go in views and then for css, images such as logo that won't change , go to public and make directories called " images", "css" "js", "sounds", . Then put your assetts such as your css in css directory..sound clips in sounds.. yep you got the idea.
I'm using sqlite database and i put those 2 in writable, because yep its writable and a database needs to be written too .

Last bit to display appropriate page for domain.com/cities you create a route in Config/Routes.php

lets say:
$routes->get('/', 'Home::index');
//above is home route it uses Controller Hone and method index

$routes->get('cities', 'City::index');
"cities" tells system that when it gets a get request with domain.com/cities

it should use a controller called City.php and its method index()
{


}

inside the method index you tell system what to do . read docs on getting started.
CMS CI4 A CMS system, runs out of the box written on top of CI4
Arch Book  CodeIgniter4 on Apache(pages 92-114) 
Reply


Messages In This Thread
Please Help with routing - by jnar - 11-03-2020, 02:46 PM
RE: Please Help with routing - by InsiteFX - 11-04-2020, 12:07 AM
RE: Please Help with routing - by captain-sensible - 11-04-2020, 02:02 AM
RE: Please Help with routing - by jnar - 11-04-2020, 06:19 AM
RE: Please Help with routing - by jnar - 11-04-2020, 08:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB