Using the Framework: Unterschied zwischen den Versionen

Aus CodeCoupler Wiki
Zur Navigation springen Zur Suche springen
Tm (Diskussion | Beiträge)
Die Seite wurde neu angelegt: „= Basics = == MVC Approach == CodeCoupler use CodeIgniter as base. CodeIgniter is a web application framework using the Model-View-Controller approach, which…“
 
Tm (Diskussion | Beiträge)
KKeine Bearbeitungszusammenfassung
Zeile 5: Zeile 5:
CodeCoupler use CodeIgniter as base. CodeIgniter is a web application framework using the Model-View-Controller approach, which allows separation between logic and presentation. To "write" a page you need at least a controller and a view.
CodeCoupler use CodeIgniter as base. CodeIgniter is a web application framework using the Model-View-Controller approach, which allows separation between logic and presentation. 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:
Create a file named '''test.php''' in the folder '''application/controllers/''' with the following code:


<syntaxhighlight>
<syntaxhighlight>
Zeile 17: Zeile 17:
</syntaxhighlight>
</syntaxhighlight>


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


<syntaxhighlight lang="html4strict">
<syntaxhighlight lang="html4strict">

Version vom 22. August 2012, 18:10 Uhr

Basics

MVC Approach

CodeCoupler use CodeIgniter as base. CodeIgniter is a web application framework using the Model-View-Controller approach, which allows separation between logic and presentation. 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:

<html>
<head>
	<title>Hello World!</title>
</head>
<body>
	<h1>Hello World!</h1>
</body>
</html>

Now open the url "http://<yourdomain>/test". You will see your first webpage created with this framework. To understand the whole CodeIgniter framework you should read the very clear and thorough documentation here: http://codeigniter.com/user_guide/index.html