Explorar el Código

Index with list of blogs

Afwerken
Ruben De Baets hace 2 años
padre
commit
b850b48626
Se han modificado 3 ficheros con 16 adiciones y 9 borrados
  1. 1
    1
      public/index.php
  2. 5
    0
      src/Model/Blogs.php
  3. 10
    8
      templates/index.html.twig

+ 1
- 1
public/index.php Ver fichero

@@ -69,7 +69,7 @@ $app->get('/', function (Request $request, Response $response, array $args) {
//TODO: load the blog data

$vars = [
"content" => "Dit is de main body met info"
"content" => $blogs
];

$twig = $this->get('twig');

+ 5
- 0
src/Model/Blogs.php Ver fichero

@@ -31,4 +31,9 @@ class Blogs
}
return $this;
}

public function getBlogsList()
{
return $this->blogs;
}
}

+ 10
- 8
templates/index.html.twig Ver fichero

@@ -1,8 +1,10 @@
{% extends "base.html.twig" %}


{% block main %}

{{ content }}

{% endblock %}
{% extends "base.html.twig" %} {% block main %}

<ul>
{% for blog in content.getBlogsList%}
<li>
<a href="/blog/{{ blog.slug }}">{{ blog.title }}</a>
</li>
{% endfor %}
</ul>
{% endblock %}

Cargando…
Cancelar
Guardar