From 9f2cebdff81c554d1d79df545bb98d4cd00efbbd Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Wed, 13 May 2015 13:25:47 +0000 Subject: [PATCH] outputtxt : allow the titles to be longer than the datas, without error git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2170 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- outputtxt.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/outputtxt.php b/outputtxt.php index 7bfb2d8..3087660 100644 --- a/outputtxt.php +++ b/outputtxt.php @@ -58,9 +58,18 @@ class outputtxt extends output } } + if ($this->table === true) { // Display the table if it is not a tree format + + // Check if the titles are longer than the data + foreach (reset ($data) as $key=>$val) + { + if (strlen ($key) > $sizes[$key]) + $sizes[$key] = strlen ($key); + } + // Prepare the border $line = reset ($data); $border = "";