Difference between revisions of "6CS028 Workshop - Web Frameworks"

From mi-linux
Jump to navigationJump to search
 
(28 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Main Page]] >> [[6CS028|Advanced Web Development]] >> [[6CS028 - Workbook|Workbook]] >> Week 02
+
[[Main Page]] >> [[6CS028|Advanced Web Development]] >> [[6CS028 - Workbook|Workbook]] >> Week 03
  
== Codeigniter==
+
== PHP Web Frameworks and databases ==
  
Please [https://codeigniter.com/user_guide/installation/index.html install Codeigniter] and work through the following tutorials:
+
=== CodeIgniter ===
* [https://codeigniter.com/user_guide/tutorial/index.html https://codeigniter.com/user_guide/tutorial/index.html]
 
  
=== How to include external files (images, css files, js files) on my pages ===
+
This week, go through the following steps of the tutorial:
 +
* [https://codeigniter.com/user_guide/tutorial/news_section.html News Section]
 +
* [https://codeigniter.com/user_guide/tutorial/create_news_items.html Create News Items]
  
First make sure your base URL is populated in your config.php file, so for example for me:
+
Then read the following sections of the documentation, to consolidate the above:
 +
* [https://codeigniter.com/user_guide/database/index.html Working With Databases]
  
<pre>
+
=== Laravel ===
$config['base_url']='http://mi-linux.wlv.ac.uk/~in9352/codeigniter3/';
 
</pre>
 
  
Then upload your files in your "codeigniter" folder, or in suitable sub-folders (codeigniter/images, codeigniter/css and codeigniter/js). Do '''NOT''' upload the files into your codeigniter/application folder or any of its sub folders.
+
This week, read the following sections of the documentation:
 +
* [https://laravel.com/docs/10.x/database Database]
  
In the example below I have uploaded an image and a CSS file at the following locations:
+
And work through the remaining sections of the Bootcamp tutorial:
*codeigniter3/css/style.css
+
* [https://bootcamp.laravel.com/inertia/editing-chirps Editing Chirps]
*codeigniter3/funnycat.jpg
+
* [https://bootcamp.laravel.com/inertia/deleting-chirps Deleting Chirps]
 
+
* [https://bootcamp.laravel.com/inertia/notifications-and-events Notifications & Events]
Finally use the "Base URL" helper in your view:
 
 
 
<pre>
 
<?php $this->load->helper('url');?>
 
<html>
 
<head>
 
  <title><?php echo $title ?> - CodeIgniter 2 Tutorial</title>
 
  <link rel="stylesheet" type="text/css" href="<?=base_url("css/style.css")?>">
 
</head>
 
<body>
 
  <h1>CodeIgniter Tutorial</h1>
 
<p>
 
<img src="<?=base_url("funnycat.jpg")?>">
 
</p> 
 
</pre>
 
 
 
=== Hiding "index.php" using URL rewriting ===
 
 
 
Create a .htaccess file in your CodeIgniter root folder, and paste the following rules inside it:
 
 
 
<pre>
 
RewriteEngine on
 
RewriteBase /~in9352/codeigniter3/
 
RewriteCond $1 !^(index\.php|images|robots\.txt)
 
RewriteCond %{REQUEST_URI} !\.(css|gif|ico|jpg|js|png|swf|txt)$
 
RewriteRule ^(.*)$ index.php/$1 [L]
 
</pre>
 
 
 
Note: replace "in9352" by your student number.
 
 
 
Working example here: [http://mi-linux.wlv.ac.uk/~in9352/codeigniter3/news/index http://mi-linux.wlv.ac.uk/~in9352/codeigniter3/news/index]
 

Latest revision as of 12:44, 17 January 2024

Main Page >> Advanced Web Development >> Workbook >> Week 03

PHP Web Frameworks and databases

CodeIgniter

This week, go through the following steps of the tutorial:

Then read the following sections of the documentation, to consolidate the above:

Laravel

This week, read the following sections of the documentation:

And work through the remaining sections of the Bootcamp tutorial: