diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index b0b67b2fb8d..4cb19f6dc7e 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -5595,7 +5595,7 @@ function getCommonSubstitutionArray($outputlangs, $onlykey=0, $exclude=null, $ob * Make substition into a text string, replacing keys with vals from $substitutionarray (oldval=>newval). * * @param string $text Source string in which we must do substitution - * @param array $substitutionarray Array with key->val to substitute + * @param array $substitutionarray Array with key->val to substitute. Example: array('__MYKEY__' => 'MyVal') * @param Translate $outputlangs Output language * @return string Output string after substitutions * @see complete_substitutions_array diff --git a/htdocs/langs/en_US/website.lang b/htdocs/langs/en_US/website.lang index 5b50bcc7ad3..a329661a056 100644 --- a/htdocs/langs/en_US/website.lang +++ b/htdocs/langs/en_US/website.lang @@ -61,4 +61,6 @@ WebsiteAccount=Web site account WebsiteAccounts=Web site accounts AddWebsiteAccount=Create web site account BackToListOfThirdParty=Back to list for Third Party -DisableSiteFirst=Disable website first \ No newline at end of file +DisableSiteFirst=Disable website first +MyContainerTitle=My web site title +AnotherContainer=Another container diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 3f50b9e9b4f..96120b278c1 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -514,7 +514,9 @@ if ($action == 'addcontainer') $objectpage->lang = GETPOST('WEBSITE_LANG','aZ09'); $objectpage->htmlheader = GETPOST('htmlheader','none'); - $objectpage->content = '

'.$langs->trans("MyContainerTitle").'

'.$langs->trans("MyContainerContent").'


'; + $substitutionarray=array(); + $substitutionarray['__WEBSITE_CREATE_BY__']=$user->getFullName($langs); + $objectpage->content = make_substitutions(file_get_contents(DOL_DOCUMENT_ROOT.'/website/pagetemplate.html'), $substitutionarray); } if (! $error) @@ -605,13 +607,17 @@ if ($action == 'addcontainer') if (! dol_is_file($filehtmlheader)) { - $htmlheadercontent = "\n\n"; + $htmlheadercontent ="\n"; + $htmlheadercontent.=''."\n"; + $htmlheadercontent.=''."\n"; + $htmlheadercontent.=''."\n"; + $htmlheadercontent.=""; $result=dolSaveHtmlHeader($filehtmlheader, $htmlheadercontent); } if (! dol_is_file($filecss)) { - $csscontent = "/* CSS content (all pages) */\nbody.bodywebsite { margin: 0; }"; + $csscontent = "/* CSS content (all pages) */\nbody.bodywebsite { margin: 0; font-family: 'Open Sans', sans-serif; }\n.bodywebsite h1 { margin-top: 0; margin-bottom: 0; padding: 10px;}"; $result=dolSaveCssFile($filecss, $csscontent); } @@ -1634,7 +1640,7 @@ if ($action == 'editcss') { $csscontent = GETPOST('WEBSITE_CSS_INLINE'); } - if (! trim($csscontent)) $csscontent='/* CSS content (all pages) */'."\n".'body.bodywebsite { margin: 0; }'; + if (! trim($csscontent)) $csscontent='/* CSS content (all pages) */'."\n"."body.bodywebsite { margin: 0; font-family: 'Open Sans', sans-serif; }\n.bodywebsite h1 { margin-top: 0; margin-bottom: 0; padding: 10px;}"; if (GETPOST('editcss','alpha') || GETPOST('refreshpage','alpha')) { @@ -1650,16 +1656,23 @@ if ($action == 'editcss') if (GETPOST('editcss','alpha') || GETPOST('refreshpage','alpha')) { - $htmlheader = @file_get_contents($filehtmlheader); + $htmlheadercontent = @file_get_contents($filehtmlheader); // Clean the php htmlheader file to remove php code and get only html part - $htmlheader = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htmlheader); + $htmlheadercontent = preg_replace('/<\?php \/\/ BEGIN PHP[^\?]*END PHP \?>\n*/ims', '', $htmlheadercontent); } else { - $htmlheader = GETPOST('WEBSITE_HTML_HEADER'); + $htmlheadercontent = GETPOST('WEBSITE_HTML_HEADER'); } - if (! trim($htmlheader)) $htmlheader="\n\n"; - else $htmlheader=''."\n".trim($htmlheader)."\n".''; + if (! trim($htmlheadercontent)) + { + $htmlheadercontent ="\n"; + $htmlheadercontent.=''."\n"; + $htmlheadercontent.=''."\n"; + $htmlheadercontent.=''."\n"; + $htmlheadercontent.=""; + } + else $htmlheadercontent=''."\n".trim($htmlheadercontent)."\n".''; if (GETPOST('editcss','alpha') || GETPOST('refreshpage','alpha')) { @@ -1737,7 +1750,7 @@ if ($action == 'editcss') print $form->textwithpicto($langs->trans('WEBSITE_HTML_HEADER'), $htmlhelp, 1, 'help', '', 0, 2, 'htmlheadertooltip'); print ''; - $doleditor=new DolEditor('WEBSITE_HTML_HEADER', $htmlheader, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); + $doleditor=new DolEditor('WEBSITE_HTML_HEADER', $htmlheadercontent, '', '220', 'ace', 'In', true, false, 'ace', 0, '100%', ''); print $doleditor->Create(1, '', true, 'HTML Header', 'html'); print ''; diff --git a/htdocs/website/pagetemplate.html b/htdocs/website/pagetemplate.html new file mode 100644 index 00000000000..a6e4e64c871 --- /dev/null +++ b/htdocs/website/pagetemplate.html @@ -0,0 +1,15 @@ +
+

__[MAIN_INFO_SOCIETE_NOM]__


+__(MyContainerTitle)__ +
+
+
+
+
__(AnotherContainer)__
+
+
+
+
+
__WEBSITE_CREATE_BY__
+
+
\ No newline at end of file