and to parse section in your wiki template. Use the skin.php to set the flags to zero, do not forget to 'GLOBAL' the flags: global $EnableShel; global $ShelPageTextOnly; $EnableShel=0; $ShelPageTextOnly=0; Example below parse PageText and RightBar but ommit SideBar (:include SideBar:) (:include RightBar:) */ SDV($EnableShel,1); SDV($ShelPageTextOnly,1); /* Override this in your config.php or skin.php in case you want to define these in the css file */ SDV($max_colours,4); SDV($HTMLStylesFmt['sehl']," .hl0 { background-color: #9999FF } .hl1 { background-color: #FFFF99 } .hl2 { background-color: #FF99FF } .hl3 { background-color: #99FFFF } .hl4 { background-color: #FF9999 } "); function sehl_start() { global $SehlUseless; if ( $SehlUseless) return; ob_start('sehl'); } function sehl_stop() { if ($SehlUseless) return; ob_end_flush(); } function SehlBrowse($pagename, $auth = 'read') { global $EnableShel; global $ShelUseless; global $SehlKeepBrowseFunction; global $ShelPageTextOnly; if ( $EnableShel && ($ShellUseless == 0 )) { if ( $ShelPageTextOnly ) { # BRBRBR # Copied from pmwiki.php # wrapped sehl around MarkupToHtml # handle display of a page global $DefaultPageTextFmt, $FmtV, $HandleBrowseFmt, $PageStartFmt, $PageEndFmt, $PageRedirectFmt; $page = RetrieveAuthPage($pagename, $auth, true, READPAGE_CURRENT); if (!$page) Abort('?cannot read $pagename'); PCache($pagename,$page); SDV($PageRedirectFmt,"

($[redirected from] \$FullName)

\$HTMLVSpace\n"); if (isset($page['text'])) $text=$page['text']; else $text = FmtPageName($DefaultPageTextFmt,$pagename); if (@!$_GET['from']) { $PageRedirectFmt = ''; if (preg_match('/\\(:redirect\\s+(.+?):\\)/',$text,$match)) { $rname = MakePageName($pagename,$match[1]); if (PageExists($rname)) Redirect($rname,"\$PageUrl?from=$pagename"); } } else $PageRedirectFmt=FmtPageName($PageRedirectFmt,$_GET['from']); $text = '(:groupheader:)'.@$text.'(:groupfooter:)'; $FmtV['$PageText'] = sehl (MarkupToHTML($pagename,$text)); SDV($HandleBrowseFmt,array(&$PageStartFmt,&$PageRedirectFmt,'$PageText', &$PageEndFmt)); PrintFmt($pagename,$HandleBrowseFmt); } else { /* if ShelPageTextOnly */ ob_start('sehl'); $SehlKeepBrowseFunction($pagename); ob_flush_contents(); } } else { $SehlKeepBrowseFunction($pagename); } } /* If there is no referer, skip sehl */ $SehlUseless=0; $ref = $_SERVER['HTTP_REFERER']; if ($ref == '') { $SehlUseless=1 ; } else { $url_array = parse_url($ref); /* If there is no query string, skip */ if ($url_array[query] == '') { $SehlUseless=1 ; } else { $SehlQuery=$url_array['query']; } } if ( $SehlUseless==0 ) { $EnableIMSCaching=0; } function sehl($full_html){ global $SehlQuery; global $SehlUseless; /* If there is no query string, exit */ if ($SehlUseless) {return $full_html;} $query_array = split('&',$SehlQuery); /* This is so we can sperate the body from html if ob_start is before body */ /* Prevents highlighting words in the head tags */ list($before_body,$full_body) = split('',$full_body,2); $before_body .= '\n\t\t"; $full_body = $bleft; } /* initialise variables */ $colour = 0; /* zero-out variables */ global $max_colours ; /* Number of highlight colours in the css */ /* This is where you can add support for more search engines */ $acceptedQueryKeys = array( 'q', 'p', 'ask', 'searchfor', 'key', 'query', 'search', 'keyword', 'keywords', 'qry', 'searchitem', 'kwd', 'recherche', 'search_text', 'search_term', 'term', 'terms', 'qq', 'qry_str', 'qu', 's', 'k', 't', 'va' ); /* parse the query into keys and values */ /* Here we are making the assumption that the query will be split by ampersands. The W3C recommend using a semi-colon to avoid problems with HTML entities, and so some user-agents may use these. However, all said and done it's a fairly safe assumption. */ /* get the search terms from the query string */ foreach($query_array as $var){ $var_array = split('=',$var); if (in_array($var_array[0], $acceptedQueryKeys)){ /* TODO: strip-out advanced search paramters like (+/-) operators */ /* parse the search terms for quoted values */ $hl_array = parse_quote_string($var_array[1]); $hl_text = ''; /* zero-out variable */ /* The hl_array[] has all the terms of user interest. This is where you can pass this information to other services. We selected do_highlight(), you could easily call out to an ATOMZ search, internal search or other services here. */ /* go through and highlight the search terms in different colours */ for($j=0; $j\$2\$3",' '.$tag_matches[3][$i].' '); $full_body_hl .= substr($holder,1,(strlen($holder)-2)); /* ORIGINAL REGEX with word boundries */ /* $full_body_hl .= preg_replace("/(.*?)\b(".preg_quote($q).")\b(.*?)/i", "\$1\$2\$3", $tag_matches[3][$i]); */ } } /* return tagged text */ return $full_body_hl; } function parse_quote_string($query_string){ /* urldecode the string and setup variables */ $query_string = urldecode($query_string); //$query_string = htmlspecialchars($query_string, ENT_NOQUOTES); //$query_string = str_replace('/','',$query_string); $quote_flag = false; $word = ''; $terms = array(); /* loop through character by character and move terms to an array */ for($i=0;$i 'TH', 'þ' => 'th', 'Ð' => 'Th', 'ð' => 'th', 'ß' => 'ss', 'Œ' => 'OE', 'œ' => 'oe', 'Æ' => 'AE', 'æ' => 'ae', 'µ' => 'u')); } ?>