diff --git a/core/core.php b/core/core.php index 2a9e5e7c..e5590b22 100755 --- a/core/core.php +++ b/core/core.php @@ -530,7 +530,6 @@ class common { } else { $db->set($module,init::$defaultData[$module]); } - $db->save; } @@ -1715,6 +1714,25 @@ class common { } } + // Externaliser les contenus des pages + // Liste des pages dans pageList + $pageList = array(); + // Creation du contenu de la page + if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) { + mkdir(self::DATA_DIR . self::$i18n . '/content'); + } + foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) { + $pageList [] = $parentKey; + foreach ($parentValue as $childKey) { + $pageList [] = $childKey; + } + } + foreach ($pageList as $parentKey => $parent) { + $content = $this->getData(['page', $parent, 'content']); + file_put_contents(self::DATA_DIR . self::$i18n . '/content/' . $parent . '.html', $content); + $this->setData(['page', $parent, 'content', $parent . '.html']); + } + $this->setData(['core', 'dataVersion', 11000]); } } @@ -2144,17 +2162,20 @@ class core extends common { ) { $this->addOutput([ 'title' => $title, - 'content' => $this->getData(['page', $this->getUrl(0), 'content']), + 'content' => file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(0), 'content'])), 'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']), 'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']), 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), - 'contentRight' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barRight']),'content']), - 'contentLeft' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'content']), + 'contentRight' => $this->getData(['page',$this->getUrl(0),'barRight']) ? + file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barRight']), 'content'])) + : '', + 'contentLeft' => $this->getData(['page',$this->getUrl(0),'barLeft']) ? + file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barLeft']), 'content'])) + : '', ]); } - // Importe le module else { // Id du module, et valeurs en sortie de la page si il s'agit d'un module de page @@ -2171,10 +2192,15 @@ class core extends common { 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), - 'contentRight' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barRight']),'content']), - 'contentLeft' => $this->getData(['page',$this->getData(['page',$this->getUrl(0),'barLeft']),'content']) + 'contentRight' => $this->getData(['page',$this->getUrl(0),'barRight']) ? + file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barRight']), 'content'])) + : '', + 'contentLeft' => $this->getData(['page',$this->getUrl(0),'barLeft']) ? + file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barLeft']), 'content'])) + : '', ]); - $pageContent = $this->getData(['page', $this->getUrl(0), 'content']); + $pageContent = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(0), 'content'])); + } else { $moduleId = $this->getUrl(0); diff --git a/core/module/page/page.php b/core/module/page/page.php index cd7aa6b6..e699a7f3 100755 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -57,6 +57,7 @@ class page extends common { 'parents' => 'Le menu', 'children' => 'Le sous-menu de la page parente' ]; + public static $content = ''; /** * Duplication @@ -127,7 +128,7 @@ class page extends common { 'typeMenu' => 'text', 'iconUrl' => '', 'disable' => false, - 'content' => 'Contenu de votre nouvelle page.', + 'content' => $pageId . '.html', 'hideTitle' => false, 'breadCrumb' => false, 'metaDescription' => '', @@ -148,6 +149,11 @@ class page extends common { 'hideMenuChildren' => false ] ]); + // Creation du contenu de la page + if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) { + mkdir(self::DATA_DIR . self::$i18n . '/content'); + } + file_put_contents(self::DATA_DIR . self::$i18n . '/content/' . $pageId . '.html', '

Contenu de votre nouvelle page.

'); // Met à jour le site map $this->createSitemap('all'); // Valeurs en sortie @@ -267,6 +273,9 @@ class page extends common { } // Effacer la page $this->deleteData(['page', $url[0]]); + if (file_exists(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html')) { + unlink(self::DATA_DIR . self::$i18n . '/content/' . $url[0] . '.html'); + } $this->deleteData(['module', $url[0]]); // Met à jour le site map $this->createSitemap('all'); @@ -399,7 +408,7 @@ class page extends common { 'typeMenu' => $this->getinput('pageTypeMenu'), 'iconUrl' => $this->getinput('pageIconUrl'), 'disable'=> $this->getinput('pageEditDisable', helper::FILTER_BOOLEAN), - 'content' => (empty($this->getInput('pageEditContent', null)) ? '

 

' : $this->getInput('pageEditContent', null)), + 'content' => $pageId . '.html', 'hideTitle' => $hideTitle, 'breadCrumb' => $this->getInput('pageEditbreadCrumb', helper::FILTER_BOOLEAN), 'metaDescription' => $this->getInput('pageEditMetaDescription', helper::FILTER_STRING_LONG), @@ -420,6 +429,12 @@ class page extends common { 'hideMenuChildren' => $this->getinput('pageEditHideMenuChildren', helper::FILTER_BOOLEAN) ] ]); + // Creation du contenu de la page + if (!is_dir(self::DATA_DIR . self::$i18n . '/content')) { + mkdir(self::DATA_DIR . self::$i18n . '/content'); + } + $content = empty($this->getInput('pageEditContent', null)) ? '

 

' : $this->getInput('pageEditContent', null); + file_put_contents( self::DATA_DIR . self::$i18n . '/content/' . $pageid . '.html' , $content ); // Barre renommée : changement le nom de la barre dans les pages mères if ($this->getinput('pageEditBlock') === 'bar') { foreach ($this->getHierarchy() as $eachPageId=>$parentId) { @@ -472,6 +487,8 @@ class page extends common { self::$pagesBarId[$parentPageId] = $this->getData(['page', $parentPageId, 'title']); } } + // Contenu de la page + self::$content = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(2), 'content'])); // Valeurs en sortie $this->addOutput([ 'title' => $this->getData(['page', $this->getUrl(2), 'title']), @@ -482,5 +499,4 @@ class page extends common { ]); } } - } diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index be3941f2..82962df1 100755 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -96,7 +96,7 @@ echo template::formOpen('pageEditForm');
'editorWysiwyg', - 'value' => $this->getData(['page', $this->getUrl(2), 'content']) + 'value' => $module::$content ]); ?>