From 0d863868d69d9e2c9ae3f6f0b22b4d3a1be73ee2 Mon Sep 17 00:00:00 2001 From: vincent-peugnet Date: Sat, 17 Aug 2019 00:02:21 +0200 Subject: Feature : list is going to work soon --- app/class/modelrender.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'app/class/modelrender.php') diff --git a/app/class/modelrender.php b/app/class/modelrender.php index aa444f0..3d8f25f 100644 --- a/app/class/modelrender.php +++ b/app/class/modelrender.php @@ -143,6 +143,7 @@ class Modelrender extends Modelart { $content = $this->article($element->content()); $content = $this->automedialist($content); + $content = $this->pagelist($content); $content = $this->autotaglistupdate($content); $content = $this->date($content); $content = $this->thumbnail($content); @@ -583,6 +584,50 @@ class Modelrender extends Modelart return $text; } + /** + * Render pages list + */ + public function pagelist(string $text) : string + { + preg_match_all('~\%LIST\?([a-zA-Z0-9\]\[\&=\-\/\%]*)\%~', $text, $out); + + foreach ($out[0] as $key => $match) { + $matches[$key] = ['fullmatch' => $match, 'options' => $out[1][$key]]; + } + + $modelhome = new Modelhome(); + + if(isset($matches)) { + foreach ($matches as $match) { + $optlist = $modelhome->Optlistinit($this->artlist); + $optlist->parsehydrate($match['options']); + $table2 = $modelhome->table2($this->artlist, $optlist); + + $content = ''; + + $text = str_replace($match['fullmatch'], $content, $text); + } + } + return $text; + } + + + -- cgit v1.2.3