|
1 year ago | |
---|---|---|
README.md | 1 year ago |
A very light blog engine CMS alternative to W.P using Codeigniter 4.5.0, Bootstrap 5.3 and Sqlite3 database.
Login for admin is hidden from those that dont know the URL ( login is at URL domainName.com/blackcat); the login form for admin has a captcha, and coded so that 5 failed attempts to login results in a brush off away from site.
If your like me , you may like to play then read the instructions .
So download the zip file to your Desktop and unzip . Whats inside ?
:
[andrew@darkstars Desktop]$ tree -L 1 CI4-CMS
CI'S-CMS
├── Grunt file.J's
├── LICENSE
├── REDEEM.MD
├── app
├── builds
├── composer.json
├── composer.lock
├── package-lock.json
├── package.json
├── phpunit.xml.dist
├── public
├── scss
├── spark
├── tests
├── vendor
└── writable
The core PHP framework I have updated to 4.5.0 so its very recent as of May 17 2024 .
At the moment Composer.json is specifying : "codeigniter4/framework": "4.5.0"
When upgrading I prefer to edit the composer.json file, specifying the newer version (by one up) and run composer update command.
In other words upgrade manually step by step. If there is a Caret character in composer.json, then depending when you download my software and how far CodeIgniter has moved on, it would mean it would update to the newest version what ever that would be and there could be breaking changes, resulting in CI'S-CMS not working.
You can find upgrade instruction from one CodeIgniter version to another at:
[CodeIgniter Upgrade] https://codeigniter.com/user_guide/installation/upgrading.html
Lets fire up spark; first change directory so that from the context of the terminal its at the web root
As you can see the built in development server is listening on:
http://localhost:8080
Note in app/Config/App.php , the url has been set to :
public string $baseURL = 'http://localhost:8080';
If you have the system in Apache then you will have to set that up and edit the above. I have my development web serving on 127.0.0.9:
public string $baseURL = 'http://127.0.0.9/';
We just fired up spark and that So lets use the output url it gave us that HTTP requests will be listened on type http://localhost:8080 directly into our browser address bar :
you should see or a variation of that :
Now to make things easier i have set up a user (with role of admin powers ) as follows:
User : Demo
Password : Demo
So enter those into text box at this :
http://localhost:8080/blackcat
You should then see :
The password is encrypted before its stored in database. The code will check if what you enter into the login textbox whether it matches the password (that is encrypted ) in the database.
Once logged in, your are taken to the admin page, where you can change the user name and password to something else . Your new admin user handle and password will replace the old ones .
The link to do that is called "resetAdminPw" .
If you get things working on local dev, you can just zip up everything and load to your live hosting as appropriate thats what i did .This is the directory structure of a live working website using CI4-CMS
Those directories of CI4-CMS built on top of CodeIgniter4 are within namely app,public,vendor and writable are all in a directory called
andrinaboutique.com which is itself in my main web hosting space. So i set up a subdomain
called andrinaboutique.com using cPanel. I then went to where
i bought my domain name and "pointed it" to the name server of my web hosting .
I then used "manage domains" at my main hosting account.
Finally codeIgniter works from the public directory so i did that as in the pic below .
As you can see , i simply make the public directory , the web document root. There is no need to mess about with the .htaccess file except when you want to install SSL i.e use secure socket(https) on your web instead of not secure (http) by leveraging "lets encrypt".
IN which case in the .htaccess file in public change top line below to bottom line
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
Other things you need to do are development to production. If you read the codeIgniter docs, you will know that you need to switch to production mode .You can do that by changing development to production in this line of the .env file
CI_ENVIRONMENT = development
also change your web address to domain name in
the line number 20 :
public string $baseURL = 'http://localhost:8080'; <br>
Database is sqlite3 , which is just a file, so no messing about with setting up MySQl needed
you will need to edit the controller Sendmail.php in controllers with credentials for sending out an email, and email address to where you want the email, containing data submitted by web surfer using "Contact Us" from menu.
My web as all using subdomains and cant use the main domain email. So if you look at lines from 99 in Sendmail.php you can see im using my personal Google email , to send data submitted from the contact us form to another of my emails infact a yahoo one. A link below gives you info and tutorial on PHPMailer
For licence CodeIgniter is using a MIT one. For me you are granted all permissions to do what you want
To see whats in the database called Art.db located at in directory "writable" , you can browse data if you install sqlitebrowser. You can right click on Art.db "open with" or launch sqlitebrowser from a command line eg:
[andrew@darkstar ~]$ sqlitebrowser
and navigate to Art.db using file->navigate to webroot writable
sqlitebrowser should be in your repo eg
[andrew@darkstar ~]$ pacman -Ss sqlitebrowser
extra/sqlitebrowser 3.12.2-3 [installed]
SQLite Database browser is a light GUI editor for SQLite databases, built on top of Qt
Read about sqlitebrowser at :
Gruntfile.js is present ,so its set up for development to convert custom.scss using grunt which will put css where it should be in public/custom.csss . Try using npm install to repopulate node_modules , after installing nodejs and grunt system wide. . See https://gruntjs.com/
Forum for CodeIgniter is : [CodeIgniter Forum]https://forum.codeigniter.com/ my handle is captain-sensible on there
any issues you can try me at andybrookestar@gmail.com
if you want to use Arch Linux and have a guide to setting up CodeIgniter4 have a look at this book:
https://www.amazon.co.uk/dp/B0C2SQ8RDM
I'm using Live **Demo [live demo]https://andrinaboutique.com for a live demo . Email me for user and pass to try it out live
In the blog creation form , don't put html tags around text in title input field, just put title name. Thats because style for blog title is already coded in.edit the contoller Sendmail.php to use your email that will send message ( ijust use gmail) and the email address of admin where you want message to go
see below for example tutorial of PHPMailer
[PHPMailer]https://github.com/PHPMailer/PHPMailer/wiki/Tutorial
The Gruntfile.js is at web root :
commands to use are:
'grunt sass'
'grunt watch'
The command grunt sass does a one time conversion of scss code of custom.scss to custom.css and places the custom.css in the right place (public/css).
grunt watch will keep looking for changes in the scss code , convert and update the custom.css file.
But you will need to install stuff system wide ; you will need to have nodejs, grunt-cli in my case on Arch ruby
installed system wide and then project wise from a command line , with context location web root :
$npm init
$npm install
for grunt see
See https://gruntjs.com/
Forum for CodeIgniter is : https://forum.codeigniter.com/
any issues you can try me at andybrookestar@gmail.com
If you want to have a go with CodeIgniter4 web development with Arch Linux, this book might help : [Arch Linux ]https://www.amazon.co.uk/dp/B0C2SQ8RDM?asc_source=01H8HFYCRM99TJ9FED7FSB1ZXC&tag=snxgb19-21