PrintSubmenu

Opens all subpages in a new window without template and navigation (Like the printfunction)

Code

cms.php
 
//---Mod PrintPageSubMenu----------------------
 
function InPageA($i, $x) {
    global $sn, $u;
    return '<a href="'.$sn.'?'.$u[$i].$x.'&print" target="_">';
}
 
function submenu_target() {
    global $s, $cl, $l, $tx, $cf;
    $ta = array();
    if ($s > -1) {
        $tl = $l[$s]+1+$cf['menu']['levelcatch'];
        for($i = $s+1; $i < $cl; $i++) {
            if ($l[$i] <= $l[$s])break;
            if ($l[$i] <= $tl)if(!hide($i))$ta[] = $i;
            if ($l[$i] < $tl)$tl = $l[$i];
        }
        if (count($ta) != 0)  return InPageLi($ta, 'submenutarget');
    }
}
 
function InPageLi($ta, $st) {
    global $s, $l, $h, $cl, $cf, $u;
    $tl = count($ta);
    if ($tl < 1)return;
    $t = '';
    if ($st == 'submenutarget' )$t .= '<ul >';
    $b = 0;
    if ($st > 0) {
        $b = $st-1;
        $st = 'menulevel';
    }
    $lf = array();
    for($i = 0; $i < $tl; $i++) {
        $tf = ($s != $ta[$i]);
        if ($st == 'menulevel' || $st == 'sitemaplevel') {
            for($k = (isset($ta[$i-1])?$l[$ta[$i-1]]:$b); $k < $l[$ta[$i]]; $k++)$t .= '<ul class="'.$st.($k+1).'">';
        }
        $t .= '<li class="';
        if (!$tf)$t .= '';
        else if(@$cf['menu']['sdoc'] == "parent" && $s > -1) {
            if ($l[$ta[$i]] < $l[$s]) {
                if (substr($u[$s], 0, strlen($u[$ta[$i]])) == $u[$ta[$i]])$t .= '';
            }
        }
        $t .= 'submenutargetdoc';
        for($j = $ta[$i]+1; $j < $cl; $j++)if(!hide($j) && $l[$j]-$l[$ta[$i]] < 2+$cf['menu']['levelcatch']) {
            if ($l[$j] > $l[$ta[$i]])$t .= '';
            break;
        }
        $t .= '">';
        if ($tf)$t .= InPageA($ta[$i], '');
        $t .= $h[$ta[$i]];
        if ($tf)$t .= '</a>';
        if ($st == 'menulevel' || $st == 'sitemaplevel') {
            if ((isset($ta[$i+1])?$l[$ta[$i+1]]:$b) > $l[$ta[$i]])$lf[$l[$ta[$i]]] = true;
            else
                {
                $t .= '</li>';
                $lf[$l[$ta[$i]]] = false;
            }
            for($k = $l[$ta[$i]]; $k > (isset($ta[$i+1])?$l[$ta[$i+1]]:$b); $k--) {
                $t .= '</ul>';
                if (isset($lf[$k-1]))if($lf[$k-1]) {
                    $t .= '</li>';
                    $lf[$k-1] = false;
                }
            };
        }
        else $t .= '</li>';
    }
    if ($st == 'submenu' || $st == 'search')$t .= '</ul>';
    return $t;
}
 
//------------------------
 
Add to content:
 
#CMSimple $output=preg_replace('/'.chr(35).'CMSimple.*'.chr(35).'/',submenu_target(),$c[$s]);#

 
CSS
 
Class:"submenutargetdoc"

back to addons

~~DISCUSSION~~

addons/printsubmenu.txt · Last modified: 2018/04/05 14:48 (external edit)
Webdesign: NMuD chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0