Add css and backtrace support in banana example
authorx2003bruneau <x2003bruneau@9869982d-c50d-0410-be91-f2a2ec7c7c7b>
Thu, 22 Feb 2007 19:01:45 +0000 (19:01 +0000)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Fri, 4 Jan 2008 23:35:31 +0000 (00:35 +0100)
git-svn-id: svn+ssh://murphy/home/svn/banana/trunk@213 9869982d-c50d-0410-be91-f2a2ec7c7c7b

examples/index.php

index 9782014..9f59c9f 100644 (file)
@@ -34,6 +34,8 @@ setcookie('banana_lastnews', time());
 
 $banana = new MyBanana();
 $res = $banana->run();
+$css = $banana->css();
+$bt  = $banana->backtrace();
 
 session_write_close();
 
@@ -45,6 +47,11 @@ session_write_close();
     <meta name="description" content="WebForum2/Banana">
     <link href="css/style.css" type="text/css" rel="stylesheet" media="screen">
     <link href="css/banana.css" type="text/css" rel="stylesheet" media="screen">
+<?php if ($css) { ?>
+    <style type="text/css">
+        <?php echo $css; ?>
+    </style>
+<?php } ?>
     <title>
       Banana, a NNTP<->Web Gateway 
     </title>
@@ -58,6 +65,19 @@ session_write_close();
         Developed under GPL License for <a href="http://www.polytechnique.org">Polytechnique.org</a>
         Use <em>silk</em> icons from <a href="http://www.famfamfam.com/lab/icons/silk/">www.famfamfam.com</a>
       </div>
+<?php
+    if ($bt) {
+        echo "<div class=\"backtrace\">";
+        foreach ($bt as &$entry) {
+            echo "<div><pre>" . $entry['action'] . "</pre>";
+            echo "<p style=\"padding-left: 4em;\">"
+                 . "ExĂ©cution en " . sprintf("%.3fs", $entry['time']) . "<br />"
+                 . "Retour : " . $entry['code'] . "<br />"
+                 . "Lignes : " . $entry['response'] . "</p></div>";
+        }
+        echo "</div>";
+    }
+?>
     </div>
   </body>
 </html>