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:11] 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 37: Line 37:
  
 <code> <code>
-apt-get install default-mysql-server+apt-get install default-mysql-server default-mysql-client
 </code> </code>
  
Line 54: 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 102: Line 103:
 === Hello world==== === Hello world====
  
-==Create controller==+==Controller==
  
 <code> <code>
Line 123: Line 124:
 </code> </code>
  
-==Create view==+==Index view==
  
 <code> <code>
-vi app/Views/Hello.php+vi app/Views/Index.php
 </code> </code>
  
Line 133: 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 143: 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 149: 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]]