Difference between revisions of "assela Pathirana:Hacks Specific to This Site"

From assela Pathirana
Jump to navigationJump to search
 
(One intermediate revision by the same user not shown)
Line 2: Line 2:


==Search Not Working==
==Search Not Working==
When URL forwarding and very short urls used together my [[Mod_Rewrite]] scripts could not handle the search function. The following was done to overcome this problem.  
When URL forwarding and very short urls used together my [[Mod_Rewrite]] scripts could not handle the search function. The following was done to overcome this problem. Edit the skin.php and change as follows
;Note: The URL rewriting should not rewrite requests with index.php
 
<pre>
<pre>
         function getSearchLink() {
         function getSearchLink() {
                 $searchPage =& Title::makeTitle( NS_SPECIAL, 'Search' );
                 $searchPage =& Title::makeTitle( NS_SPECIAL, 'Search' );
                 #Assela hack HACK
                 #Comment the line below and add the new return line.
//                return $searchPage->getLocalURL();
//                return $searchPage->getLocalURL();
                 return "/index.php?Special:Search";
                 return "/index.php?Special:Search";
</pre>
</pre>
and change include/SpecialSearch.php as follows
<pre>
                $title = Title::makeTitle( NS_SPECIAL, 'Search' );
                //hack $action = $title->escapeLocalURL();
                $action = htmlspecialchars("/index.php?Special:Search");
</pre>
;Note: The URL rewriting should not rewrite requests with index.php


==Wildcard Search==
==Wildcard Search==
{{WikiBrowser:Mediawiki Wildcard Searching}}
{{WikiBrowser:Mediawiki Wildcard Searching}}

Latest revision as of 05:42, 22 March 2006

These hacks are dangerous. They have been done as last resort to overcome problems that were otherwise unsolvable. Do not use these in any other situation. Recorded here only as a reference.

Search Not Working

When URL forwarding and very short urls used together my Mod_Rewrite scripts could not handle the search function. The following was done to overcome this problem. Edit the skin.php and change as follows

        function getSearchLink() {
                $searchPage =& Title::makeTitle( NS_SPECIAL, 'Search' );
                #Comment the line below and add the new return line.
//                return $searchPage->getLocalURL();
                return "/index.php?Special:Search";

and change include/SpecialSearch.php as follows

                $title = Title::makeTitle( NS_SPECIAL, 'Search' );
                //hack $action = $title->escapeLocalURL();
                $action = htmlspecialchars("/index.php?Special:Search");
Note
The URL rewriting should not rewrite requests with index.php

Wildcard Search

Template:WikiBrowser:Mediawiki Wildcard Searching