From b5d72edebc0cdfc74c8948129c06734bd3e251ff Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 15 Aug 2019 18:07:36 +0200 Subject: [PATCH] Can add more samples of pages. Add an exemple of page with dynamic content. --- htdocs/core/class/html.formwebsite.class.php | 16 +- htdocs/core/lib/website.lib.php | 269 +++++++++--------- htdocs/langs/en_US/website.lang | 5 +- htdocs/website/index.php | 2 +- .../samples/page-sample-corporatehome.html | 15 - .../samples/page-sample-dynamiccontent.html | 44 +++ htdocs/website/samples/page-sample-empty.html | 6 +- 7 files changed, 207 insertions(+), 150 deletions(-) delete mode 100644 htdocs/website/samples/page-sample-corporatehome.html create mode 100644 htdocs/website/samples/page-sample-dynamiccontent.html diff --git a/htdocs/core/class/html.formwebsite.class.php b/htdocs/core/class/html.formwebsite.class.php index 3cefeaef99c..42c3b36025b 100644 --- a/htdocs/core/class/html.formwebsite.class.php +++ b/htdocs/core/class/html.formwebsite.class.php @@ -176,7 +176,21 @@ class FormWebsite $langs->load("admin"); - $arrayofsamples=array('empty'=>'EmptyPage', 'corporatehome'=>'CorporateHomePage'); + $listofsamples = dol_dir_list(DOL_DOCUMENT_ROOT.'/website/samples', 'files', 0, '^page-sample-.*\.html$'); + + $arrayofsamples = array(); + $arrayofsamples['empty']='EmptyPage'; // Always this one first + foreach($listofsamples as $sample) + { + $reg = array(); + if (preg_match('/^page-sample-(.*)\.html$/', $sample['name'], $reg)) + { + $key = $reg[1]; + $labelkey = ucfirst($key); + if ($key == 'empty') $labelkey = 'EmptyPage'; + $arrayofsamples[$key] = $labelkey; + } + } $out = ''; $out .= '