6CS028 Workshop - Web Frameworks
From mi-linux
Jump to navigationJump to searchMain Page >> Advanced Web Technologies >> Workbook >> Week 02
Codeigniter
Please install Codeigniter and work through the following tutorials: https://codeigniter.com/user_guide/tutorial/index.html
External files (images, css files, js files)
First make sure your base URL is populated in your config.php file, so for example for me:
$config['base_url']='http://mi-linux.wlv.ac.uk/~in9352/codeigniter/';
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.
In the example below I have uploaded an image and a CSS file at the following locations:
- codeigniter/css/style.css
- codeigniter/funnycat.jpg
Finally use the "Base URL" helper in your view:
<?$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 2 Tutorial</h1> <p> <img src="<?=base_url("funnycat.jpg")?>"> </p>