Skip to content

Create a view

Emaro edited this page Mar 23, 2017 · 1 revision

Create a view

Here, you'll learn to use the most basic part of this mvc framework: creating a new view.

Creation

Go to the views folder and create a file which ends with '.view.php'.

Example: home.view.php
Home is the name of your view.

Basic Content

Throw all html stuff in the view which is usually found in the body tag of your html file.

You need not to add:

  • A head
  • A navigation
  • A footer

Links

To add a link to an site within the framework, use the php short tag: <?= ?>. Special about the short tag is, that the echo/print can be left out.

<?php echo $var; ?>
<?= $var ?> // the same

The method viewLink(<id>, <label>) inserts a link to a view. If we use our example again, we will get the following code:

<!-- Some html with a link -->
<?=viewLink('home', 'Take me Home')?>

Of course you can also use normal links.

Clone this wiki locally