Is it possible format some text (or part of text) in menu differently?
E.g.
Menu 1
Menu 2
Menu 3
Menu formatting
Re: Menu formatting
No, that feature is not provided by CMSimple(_XH). With current CMSimple_XH versions you can, however, make a copy of function li() (in cmsimple/cms.php) and store it in cmsimple/userfuncs.php under a new name (say, formattedLi):
Then you have to modify the call to function toc() in your template:
So far nothing has really changed, but now you're able to modify formattedLi() (in a way that will survive updates of CMSimple_XH). The relevant line is roughly in the middle of the function:
This writes the heading of the page (i.e. the content of the heading element <hX> with all further markup stripped off) to the menu. You can replace the right hand side of the .= with something else. The question is: with what -- or expressed differently: where should the marked up heading for the menu be stored? One way is to use the already (?) formatted page heading. Then simply replace the line mentioned above with:
If you want to stick with non marked up headings on the page, but having markup in the menu, you could use the alternative heading (tab "Page").
Note, that it's also possible to set up a certain fixed markup, that is triggered by a custom page data field. You can see an example on http://www.steffens-bau.be/?Immobilien: ... %C3%A4user.
Code: Select all
function formattedLi($ta, $st) {
// ...
}
Code: Select all
<?php echo toc(null, null, 'formattedLi');?>
Code: Select all
$t .= $h[$ta[$i]];
Code: Select all
global $c;
preg_match('~<h([1-' . $cf['menu']['levels']. ']).*>(.*)</h~isU', $c[$ta[$i]], $temp);
$t .= trim(xh_rmws($temp[2]));
Note, that it's also possible to set up a certain fixed markup, that is triggered by a custom page data field. You can see an example on http://www.steffens-bau.be/?Immobilien: ... %C3%A4user.
Christoph M. Becker – Plugins for CMSimple_XH