From 188232a24e98575b61144e7910bcec04e4e236ac Mon Sep 17 00:00:00 2001 From: Cameron Date: Wed, 19 Dec 2018 12:21:53 -0800 Subject: [PATCH] Fixes #3562 deprecated news template with PHP7. --- e107_plugins/news/news.php | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/e107_plugins/news/news.php b/e107_plugins/news/news.php index dacbc2664..ad4a895a3 100644 --- a/e107_plugins/news/news.php +++ b/e107_plugins/news/news.php @@ -1466,6 +1466,9 @@ class news_front // } } + /** + * @deprecated - for BC only. May be removed in future without further notice. + */ if(isset($this->pref['news_unstemplate']) && $this->pref['news_unstemplate'] && file_exists(THEME."news_template.php")) { // theme specific template required ... @@ -1502,13 +1505,23 @@ class news_front $loop = 1; } } + $loop = 1; - foreach($newsdata as $data) { - $var = "ITEMS{$loop}"; - $$var = $data; + + $items = array(); + + foreach($newsdata as $data) + { + $var = "ITEMS".$loop; + // $$var = $data; + $items[$var] = $data; $loop ++; } - $text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWSCLAYOUT); + + + $text = $tp->parseTemplate($NEWSCLAYOUT, false, $items); + + // $text = preg_replace("/\{(.*?)\}/e", '$\1', $NEWSCLAYOUT); // Deprecated