Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tools:ci4 [2022/05/17 08:02] darrontools:ci4 [2022/08/19 12:24] (current) – [Resources] darron
Line 19: Line 19:
  
 <code> <code>
-apt install apache2 php php-cli php-mbstring php-intl php-curl php-json php-mysqlnd+apt install apache2 php php-cli php-mbstring php-intl php-curl php-json php-mysqlnd php-xml
 </code> </code>
  
Line 30: Line 30:
 Zend Engine v3.4.0, Copyright (c) Zend Technologies Zend Engine v3.4.0, Copyright (c) Zend Technologies
     with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies     with Zend OPcache v7.4.28, Copyright (c), by Zend Technologies
 +</code>
 +
 +===Install MySQL===
 +
 +Install MariaDB fork of MySQL.
 +
 +<code>
 +apt-get install default-mysql-server default-mysql-client
 +</code>
 +
 +MySQL version
 +
 +<code>
 +mysql --version
 +mysql  Ver 15.1 Distrib 10.5.15-MariaDB, for debian-linux-gnu (x86_64) using  EditLine wrapper
 </code> </code>
  
Line 39: Line 54:
 mkdir -p /var/www/htdocs mkdir -p /var/www/htdocs
 cd /var/www/htdocs cd /var/www/htdocs
-wget https://api.github.com/repos/codeigniter4/CodeIgniter4/zipball/v4.1.-O ci4.zip +wget https://api.github.com/repos/codeigniter4/CodeIgniter4/zipball/v4.2.-O ci4.2.4.zip 
-unzip ci4.zip +unzip ci4.2.4.zip 
-mv codeigniter4-CodeIgniter4-202f41a hostname.kewl.org+mv codeigniter4-CodeIgniter4-hostname.kewl.org
 cd hostname.kewl.org cd hostname.kewl.org
 chown www-data:www-data writable chown www-data:www-data writable
 </code> </code>
  
 +Warning: 4.1 would auto-detect routes but this is not the case with 4.2.
 ===Configure apache=== ===Configure apache===
  
Line 87: Line 103:
 === Hello world==== === Hello world====
  
-==Create controller==+==Controller==
  
 <code> <code>
Line 108: Line 124:
 </code> </code>
  
-==Create view==+==Index view==
  
 <code> <code>
-vi app/Views/Hello.php+vi app/Views/Index.php
 </code> </code>
  
Line 118: Line 134:
 <html lang="en"> <html lang="en">
 <head> <head>
-    <title>Hello World</title>+    <title>Index</title>
 </head> </head>
 <body> <body>
  
-<p>Hello World</p>+<!--Content start--> 
 +<?=$this->renderSection("Content")?> 
 +<!--Content end-->
  
 </body> </body>
Line 128: Line 146:
 </code> </code>
  
-==Visit URL==+==Controller view== 
 + 
 +<code> 
 +vi app/Views/Hello.php 
 +</code> 
 + 
 +<code> 
 +<?php 
 +    $this->extend("Index"); 
 +    $this->section("Content"); 
 +    phpinfo(); 
 +    $this->endSection(); 
 +?> 
 +</code> 
 + 
 +==Route== 
 + 
 +vi app/Config/Routes.php 
 +<code> 
 +$routes->get('/Hello', 'Hello::index'); 
 +</code> 
 + 
 +==URL==
  
 <code> <code>
Line 134: Line 174:
 </code> </code>
  
 +===Resources===
 +
 +[[https://codeigniter4.github.io/CodeIgniter4/outgoing/view_layouts.html|View layouts]]
 +
 +[[https://codeigniter.com/user_guide/incoming/routing.html|Routing]]
 +
 +[[https://onlinewebtutorblog.com/codeigniter-4/what-is-codeigniter/|Basic overview]]