<?php require_once $_SERVER['SRVROOT'] . "/cms/inc/config.inc.php"; $myNode = $cms->xpath->query("//page[@id={$_POST['cmsid']}]")->item(0); $childNodes = $cms->xpath->query("//page[@id={$_POST['cmsid']}]/page"); if ($_POST['cmsid'] == 0) { echo '<div align="center">'; echo "此頁為根目錄無法刪除。"; echo "<br /><a href=\"javascript:window.close()\">關閉視窗</a>"; echo '</div>'; } elseif ($childNodes->length > 0) { echo '<div align="center">'; echo "此階層下含有子階層,無法刪除<br>請移除子階層後再執行刪除。"; echo "<br /><a href=\"javascript:window.close()\">關閉視窗</a>"; echo '</div>'; } else { $pid = $myNode->parentNode->getAttribute('id'); $myNode->parentNode->removeChild($myNode); $ok = $cms->dom->save(CMSXML); $backurl = $_SERVER['WEBROOT'] . '/cms/admin/index.php?cmsroot=content&cmsid=' . $pid; if ($ok) { echo "刪除成功"; echo "\r\n\t\t\t<script>\r\n\t\t\tfunction closeWindow(){\r\n\t\t\twindow.opener.location.href='{$backurl}';\r\n\t\t\twindow.close(); \r\n\t\t\t}\r\n\t\t\tcloseWindow();\r\n\t\t\t</script>\r\n\t\t"; } else { echo "刪除失敗"; echo "<br /><a href=\"javascript:window.close()\">關閉視窗</a>"; } $backurl = keepUrl('', $_POST['comefrom']); $backurl = addUrl('cmsid=' . $pid, $backurl); //echo "<meta http-equiv=\"refresh\" content=\"1.6;URL=$backurl\" />"; }
<p><strong>範例:</strong></p> <p>Ex1: <?php highlight_string('<?php echo keepUrl("v1,v2,v3"); ?>'); ?> </p> <p><?php echo keepUrl("v1,v2,v3"); ?> </p> <p>Ex2:<?php highlight_string('<?php echo keepUrl("v1,v2,v3",$testurl); ?>'); ?> </p> <p><?php echo keepUrl("v1,v2,v3", $testurl); ?> </p> <h3>4. makeUrl($addUrl, $cutUrl='', $baseUrl='')</h3> <p><strong>功能:</strong>結合 addUrl 與 cutUrl使用</p> <p><strong>參數說明:</strong></p> <p>$addUrl 如 'v1=a&v2=b'</p> <p>$cutUrl 如 'v2,v3'</p> <p>$baseUrl 為 optional 預設為 $_SERVIER['REQUEST_URI']</p> <p><strong>範例:</strong></p> <p>Ex1: <?php highlight_string('<?php echo makeUrl("v4=test","v1,v2,v3");?>'); ?> </p> <p><?php