User Tools

Site Tools


basic-website

Basic Website with Tina4

Tina4 already has Twig template engine built in so creating a website is one of the easiest things you can do. Start off by creating an index.twig file in the src/templates folder. If you hit up the default URL http://localhost:7145 then you will see a blank page.

You can then flesh out your index.twig file with valid HTML. The beauty of Twig is you can include other files, for example a header or footer. The example below illustrates this.

src/templates/index.twig
<!DOCTYPE html>
<html>
  {%include "snippets/header.twig"%}
<body>
  <h1>This is a Heading</h1>
  <p>This is a paragraph.</p>
  {%include "snippets/footer.twig"%}
</body>
</html>
src/templates/snippets/header.twig
<head>
<title>Page Title</title>
</head>
src/templates/snippets/footer.twig
<footer>
  <a href="https://tina4.com">Tina4</a>
</footer>
basic-website.txt · Last modified: 2021/06/15 15:05 by andre