Hello World: Unterschied zwischen den Versionen

Aus CodeCoupler Wiki
Zur Navigation springen Zur Suche springen
Tm (Diskussion | Beiträge)
Die Seite wurde neu angelegt: „To "write" a page you need at least a controller and a view. Create a file named '''test.php''' in the folder '''application/controllers/''' with the followin…“
 
Tm (Diskussion | Beiträge)
Keine Bearbeitungszusammenfassung
Zeile 16: Zeile 16:


<syntaxhighlight lang="html4strict">
<syntaxhighlight lang="html4strict">
<html>
<h1>Hello World!</h1>
<head>
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
</syntaxhighlight>
</syntaxhighlight>


Now open the url <nowiki>"http://<yourdomain>/test"</nowiki>. You will see your first webpage created with this framework.
Now open the url <nowiki>"http://<yourdomain>/test"</nowiki>. You will see your first webpage created with this framework.
{{Hint|'''Do you know CodeIgniter?'''<br/>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.}}

Version vom 22. August 2012, 19:02 Uhr

To "write" a page you need at least a controller and a view.

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.