From ca5967daef23ece726cdf74223fe4370ebeedc95 Mon Sep 17 00:00:00 2001
From: "Hahn Axel (hahn)" <axel.hahn@iml.unibe.ch>
Date: Mon, 12 Dec 2022 18:59:44 +0100
Subject: [PATCH] update visual output

---
 public_html/inc_functions.php   | 36 +++++++++++++++++++++++----------
 public_html/pages/component.php |  2 +-
 public_html/ui/main.css         |  2 ++
 3 files changed, 28 insertions(+), 12 deletions(-)
 create mode 100644 public_html/ui/main.css

diff --git a/public_html/inc_functions.php b/public_html/inc_functions.php
index f2a5a28..3118b31 100644
--- a/public_html/inc_functions.php
+++ b/public_html/inc_functions.php
@@ -7,16 +7,30 @@ function showExample($sPhpcode){
     eval("\$sOut=$sPhpcode;");
 
     return '
-        <h3>PHP code</h3>
-        <pre>'.htmlentities($sPhpcode).'</pre>
-
-        <h3>Output</h3>
-            visual output:<br>
-            <br>
-            '.$sOut.'
-            <br>
-            generated html code:
-            <pre>'.htmlentities(str_replace([">", "</"], [">\n", "\n</"], $sOut)).'</pre>
-
+        <table class="table">
+            <thead>
+                <tr>
+                    <th>Source</th>
+                    <th>Output</th>
+                    <th>Generated html code</th>
+                </tr>
+            </thead>
+            <tbody>
+                <tr>
+                    <td>
+                    <div class="language-php max-height-300 highlighter-rouge"><div class="highlight">
+                        <pre class="highlight">'.htmlentities($sPhpcode).'</pre>
+                    </div></div>
+                    </td>
+                    <td>
+                        '.$sOut.'
+                    </td>
+                    <td>
+                        <pre>'.htmlentities(str_replace([">", "</"], [">\n", "\n</"], $sOut)).'</pre>
+                    </td>
+                </tr>
+            </tbody>
+        </table>
+    
     ';
 }
\ No newline at end of file
diff --git a/public_html/pages/component.php b/public_html/pages/component.php
index eefcb52..290c17b 100644
--- a/public_html/pages/component.php
+++ b/public_html/pages/component.php
@@ -41,7 +41,7 @@ if(!isset($aComponents[$sComponent])){
     )
     .$renderAdminLTE->addRow(
         '<h3>Syntax</h3>
-        <pre>echo $renderAdminLTE-><strong>'.$aComp['method'].'</strong>($aOptions)</pre>
+        <code>echo $renderAdminLTE-><strong>'.$aComp['method'].'</strong>($aOptions)</code>
         '
     );
 
diff --git a/public_html/ui/main.css b/public_html/ui/main.css
new file mode 100644
index 0000000..6648c96
--- /dev/null
+++ b/public_html/ui/main.css
@@ -0,0 +1,2 @@
+
+pre{background-color: #445; color: #f8f8f8};
\ No newline at end of file
-- 
GitLab