From 3ba5f81b7bc99d7ff954aa5b76aca93c9e157e67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Sun, 4 Aug 2013 18:07:41 +0200 Subject: [PATCH] twig implementation --- inc/poche/pocheCore.php | 12 +++----- tpl/css/style.css | 4 --- tpl/view.twig | 65 +++++++++++++++-------------------------- 3 files changed, 28 insertions(+), 53 deletions(-) diff --git a/inc/poche/pocheCore.php b/inc/poche/pocheCore.php index 9cbcc0772..74b063e4d 100644 --- a/inc/poche/pocheCore.php +++ b/inc/poche/pocheCore.php @@ -187,20 +187,16 @@ function display_view($view, $id = 0) $entry = $store->retrieveOneById($id); if ($entry != NULL) { pocheTools::logm('view link #' . $id); - $tpl->assign('id', $entry['id']); - $tpl->assign('url', $entry['url']); - $tpl->assign('title', $entry['title']); $content = $entry['content']; if (function_exists('tidy_parse_string')) { $tidy = tidy_parse_string($content, array('indent'=>true, 'show-body-only' => true), 'UTF8'); $tidy->cleanRepair(); $content = $tidy->value; } - $tpl->assign('content', $content); - $tpl->assign('is_fav', $entry['is_fav']); - $tpl->assign('is_read', $entry['is_read']); - $tpl->assign('load_all_js', 0); - $tpl->draw('view'); + $tpl_vars = array( + 'entry' => $entry, + 'content' => $content, + ); } else { pocheTools::logm('error in view call : entry is NULL'); diff --git a/tpl/css/style.css b/tpl/css/style.css index 69e374971..d856a3545 100644 --- a/tpl/css/style.css +++ b/tpl/css/style.css @@ -203,8 +203,4 @@ body.article { margin-left: 0; margin-right: 0; } -} - -.messages { - } \ No newline at end of file diff --git a/tpl/view.twig b/tpl/view.twig index e68cd1a14..d2ec2071c 100644 --- a/tpl/view.twig +++ b/tpl/view.twig @@ -1,58 +1,41 @@ - - - - - - - - - - - {$title} - - - - - - - - - - - - -
+{% extends "layout.twig" %} +{% block title %}{% trans "home" %}{% endblock %} + +{% block content %} +
- +
-

{$title}

- +

{{ entry.title|e }}

+
- {include="messages"}
- {$content} + {{ content|striptags }}
- +
- - + +
- this article appears wrong? create an issue or contact us by mail + {% trans "this article appears wrong?" %} {% trans "create an issue" %} {% trans "or" %} {% trans "contact us by mail" %}
- +
+{% endblock %} - {include="js"} - {include="footer"} \ No newline at end of file +{% block js %} + + +{% endblock %} \ No newline at end of file