From 4486f99b72af3b42bfb95622b35f2fe6cbebf62a Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Tue, 22 Jan 2019 09:44:21 +0000 Subject: [PATCH] outputhtml : catch only de layout zones not used and not all the {XXXX} text git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4869 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- outputhtml.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/outputhtml.php b/outputhtml.php index 6dc5b09..79b5f83 100644 --- a/outputhtml.php +++ b/outputhtml.php @@ -86,6 +86,9 @@ class outputhtml extends output EOT; } + // Get all the substitute zones + preg_match_all ("~({[\w_-]+})~", $layoutPage, $matches); + $zones = $matches[1]; // All the entries coming from views in array are substitute in layout // {content}, {title} @@ -106,7 +109,8 @@ EOT; $layoutPage = str_replace ($key, $val, $layoutPage); // Remove the not used {XXX} - $layoutPage = preg_replace ("~({[\w_-]+})~", "", $layoutPage); + foreach ($zones as $zone) + $layoutPage = str_replace ($zone, "", $layoutPage); //echo $layoutPage;exit; // Manage the timestamp/md5sum for the external files managed by this @@ -126,7 +130,7 @@ EOT; if (! empty ($errors)) { echo "ERROR: Invalid HTML provided\n"; - echo "
";var_dump ($errors);
+      echo "
"; print_r ($errors);
       foreach (explode ("\n", $layoutPage) as $key => $val)
       {
         echo sprintf ("%5d", $key+1)." ".htmlentities ($val)."\n";