Hello World: Unterschied zwischen den Versionen

Aus CodeCoupler Wiki
Zur Navigation springen Zur Suche springen
Tm (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Tm (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
 
Zeile 1: Zeile 1:
To "write" a page you need at least a controller and a view.
To "write" a page you need at least a controller and a view. First of all create a file named '''test.php''' in the folder '''application/controllers/''' with the following code:
 
Create a file named '''test.php''' in the folder '''application/controllers/''' with the following code:


<syntaxhighlight>
<syntaxhighlight>

Aktuelle Version vom 22. August 2012, 20:35 Uhr

To "write" a page you need at least a controller and a view. First of all create a file named test.php in the folder application/controllers/ with the following code:

<?php
class Test extends CI_Controller {
	public function index()
	{
		$this->load->view('test');
	}
}

Then create a file named test.php in the folder application/views/ with the following code:

<h1>Hello World!</h1>

Now open the url "http://<yourdomain>/test". You will see your first webpage created with this framework.


Hint
Hint

Do you know CodeIgniter?
Maybe you wonder why we do not put <html>, <head> and <body> into the view. But if you read the sourcecode in the browser you will detect a complete html-structure. This is one big difference you should know. Please read the chapter Master Template. In contrast to the pure CodeIgniter framework, CodeCoupler will surround every controller ouput with a master template.