Thank you,
Christian
--- My suggested solution (25.3.21):
Unfortunately the 1.7-Development has eliminated the previously straightforward functionality of creating the menu by splitting the content by html headlines (as it was until 1.6.10). This adds more complexities and difficulties to the system.
I have written some lines of code (I am not a php programmer) that brings back the classic CMSimple headlines splitting by automatically creating the necessary XH_ml html comments.
Users that are interested can implement the following steps:
1. Set $cf['mode']['advanced'] = "true"; (thank you, Christoph) in cmsimple/config.php.
This shows the XH_ml comments in the code editor of TinyMCE and gives back a bit more control over what is happening behind the scenes.
2. Save the following code to cmsimple/userfuncs.php:
Code: Select all
function create_ml_comments($text){
global $cf;
if(!$cf['mode']['advanced']){return $text;}
# $cf['menu']['levels'] (config.php)
# can not be used since it is overwritten in functions.php
$ml = 5;
$text = preg_replace("/<!--XH_ml.*[\n\r]/i",'', $text);
preg_match_all('/(<h[1-'.$ml.'].*?>.*?<\/h[1-'.$ml.']>)/',$text,$hls);
foreach($hls[0] as $headline){
preg_match('/<h([1-'.$ml.']).*?(title="(.*?)"|)>(.*?)<\/h[1-'.$ml.']>/',$headline,$hls);
$title=$hls[4];
if($hls[3]!=""){$title=$hls[3];}
$text =
str_replace($headline,'<!--XH_ml'.$hls[1].':'.$title."-->\n".$headline,$text);
}
return $text;
}
3. Put the following line in cmsimple/adminfuncs.php in function XH_saveEditorContents():
$text = create_ml_comments($text);
(I am not sure where the best place is; probably somewhere at the beginning or at the end. I put mine after global...)
As you can see in my code, you can still have an alternative menu entry by using the title option in the html headline tag.
<h1 title="alternative entry for menu">...
1.7-Development may please include this in future releases to return a little simplicity to CMSimple as originally intended by Peter Harteg (simple, small, fast).
Thank you very much and greetings,
Christian