Wikka Mod 041

Type: Feature Addition

Credit

Mark Kasper and GmBowen (main credit for the idea and initial code)
AHerdOfTurtles (for helping me see that this is a cool idea)
Jason Tourtelotte (major refinement to the code -- almost a complete rewrite)

Description


This modification adds the ability to show an index listing of pages that start with a certain letter. There is also an alphabetical heading at the top of each listing. Just click a letter to see pages that start with that letter.

For example:

Usage:

{{pageindex letter="d"}}


Outcome:

Page Index


This is an alphabetical list of pages you can read on this server.
 
All  #  A  #  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z 

F
FabriceFrassaint [FabriceFrassaint] . . . . Owner: FabriceFrassaint
FajarSumirat [FajarSumirat] . . . . Owner: FajarSumirat
FarrasSonjaya [FarrasSonjaya] . . . . Owner: FarrasSonjaya
FaviconDotIco [FaviconDotIco] . . . . Owner: DotMG
FCKeditorIntegration [FCKeditorIntegration] . . . . Owner: MaiGre
FedeToschi [FedeToschi] . . . . Owner: FedeToschi
FeedbackAction [FeedbackAction] . . . . Owner: DarTar
FeedbackActionUpgrade [FeedbackActionUpgrade] . . . . Owner: DarTar
FernandoBorcel [FernandoBorcel] . . . . Owner: FernandoBorcel
FileexportAction [FileexportAction] . . . . Owner: DomBonj
FileexportActionInfo [FileexportActionInfo] . . . . Owner: DomBonj
FileManagerHack [FileManagerHack] . . . . Owner: ChiWaWa
FileModificationTime [FileModificationTime] . . . . Owner: JasonHuebel
FilesAction [FilesAction] . . . . Owner: NilsLindenberg
FilesActionHillar [FilesActionHillar] . . . . Owner: HillarAarelaid
FilesActionInfo [FilesActionInfo] . . . . Owner: NilsLindenberg
FilesActionSafeModeWorkaround [FilesActionSafeModeWorkaround] . . . . Owner: CyneBeald
FilesHandler [FilesHandler] . . . . Owner: ChristianBarthelemy
FilesHandlerInfo [FilesHandlerInfo] . . . . Owner: ChristianBarthelemy
FilesManagementHandler [FilesManagementHandler] . . . . Owner: ChristianBarthelemy
FilesManagementSolution [FilesManagementSolution] . . . . Owner: ChristianBarthelemy
FileUploadsDiscussion [FileUploadsDiscussion] . . . . Owner: DarTar
FileView [FileView] . . . . Owner: SmaugDragon
FilippL [FilippL] . . . . Owner: FilippL
FireFox [FireFox] . . . . Owner: BrianKoontz
FishPete [FishPete] . . . . Owner: FishPete
FixedForegroundImage [FixedForegroundImage] . . . . Owner: DarTar
FlashActionInfo [FlashActionInfo] . . . . Owner: NilsLindenberg
FlashMind [FlashMind] . . . . Owner: PradeepKishoreGowda
FlashMindMap [FlashMindMap] . . . . Owner: NitramF
FlexibleWikka [FlexibleWikka] . . . . Owner: DarTar
FlexibleWikkaES [FlexibleWikkaES] . . . . Owner: PerKhus
FlexibleWikkaFR [FlexibleWikkaFR] . . . . Owner: PivWan
FlorianL [FlorianL] . . . . Owner: FlorianL
FontActionInfo [FontActionInfo] . . . . Owner: OnkelJonas
FootnoteAction [FootnoteAction] . . . . Owner: DomBonj
FootnoteActionInfo [FootnoteActionInfo] . . . . Owner: DomBonj
ForCen [ForCen] . . . . Owner: ForCen
ForeachBugInPhp4dot3dot10 [ForeachBugInPhp4dot3dot10] . . . . Owner: DotMG
ForkFR [ForkFR] . . . . Owner: EltharielHdh
FormattedIncludeAction [FormattedIncludeAction] . . . . Owner: GmBowen
FormatterDevInfo [FormatterDevInfo] . . . . Owner: NilsLindenberg
FormatterInfo [FormatterInfo] . . . . Owner: OnegWR
FormattingInfoTemplate [FormattingInfoTemplate] . . . . Owner: JavaWoman
FormattingRules [FormattingRules] . . . . Owner: JsnX
FormattingRules1162 [FormattingRules1162] . . . . Owner: DarTar
FormattingRulesCSS [FormattingRulesCSS] . . . . Owner: Jmax1632
FormattingRulesDE [FormattingRulesDE] . . . . Owner: AdSamweis
FormatUserMethod [FormatUserMethod] . . . . Owner: DarTar
ForTheLazy [ForTheLazy] . . . . Owner: FreekNL
FpdfIntegration [FpdfIntegration] . . . . Owner: NilsLindenberg
FrankChestnut [FrankChestnut] . . . . Owner: FrankChestnut
FrankK [FrankK] . . . . Owner: FrankK
FredZ [FredZ] . . . . Owner: FredZ
FreeBSD [FreeBSD] . . . . Owner: BrianKoontz
FreeCap [FreeCap] . . . . Owner: YodaHome
FreekDijkstra [FreekDijkstra] . . . . Owner: FreekDijkstra
FreeLinks [FreeLinks] . . . . Owner: SteveB
FreeMind [FreeMind] . . . . Owner: JsnX
FreeMindKeyboardShortcuts [FreeMindKeyboardShortcuts] . . . . Owner: JsnX
FreeMindSandBox [FreeMindSandBox] . . . . Owner: DarTar
FreeNSK [FreeNSK] . . . . Owner: FreeNSK
FreeTaggingFolksonomy [FreeTaggingFolksonomy] . . . . Owner: IntElf
FudLogin [FudLogin] . . . . Owner: MreimeR



Code


[26/9/04] actions/pageindex.php file after this mod:

<?php
if ($pages = $this->LoadAllPages())
{
	if (isset($_REQUEST["letter"])) $requested_letter = $_REQUEST["letter"]; else $requested_letter = '';
	if (!$requested_letter && isset($letter)) $requested_letter = strtoupper($letter); 
	$cached_username = $this->GetUserName();
	$user_owns_pages = false;
	$link = $this->href("", "", "letter=");
	$index_header = "<strong><a href='$link'>All </a></strong> \n";
	$index_output = "";
	$current_character = "";
	$character_changed = false;

	foreach ($pages as $page)
	{
		$page_owner = $page["owner"];
		// $this->CachePage($page);

		$firstChar = strtoupper($page["tag"][0]);
		if (!preg_match("/[A-Za-z]/", $firstChar)) $firstChar = "#";
		if ($firstChar != $current_character) {
			$index_header .= "<strong><a href='$link$firstChar'>$firstChar</a></strong> \n";
			$current_character = $firstChar;
			$character_changed = true;
		}
		if ($requested_letter == '' || $firstChar == $requested_letter) {
			if ($character_changed) {
				$index_output .= "<br />\n<strong>$firstChar</strong><br />\n";
				$character_changed = false;
			}
			$index_output .= $this->Link($page["tag"]);

			if ($cached_username == $page_owner) {                       
				$index_output .= "*";
				$user_owns_pages = true;
			} elseif ($page_owner != '(Public)' && $page_owner != '') {
				$index_output .= " . . . . Owner: ".$page_owner;
			}
			 	$index_output .= "<br />\n";    
		}
	}
	$index_header .= "<br />";
	if ($user_owns_pages) $index_output .= "<br />\n* Indicates a page that you own.<br />\n";    
	print $index_header.$index_output;
} else {
	print("<em>No pages found.</em>");
}
?>
There are 5 comments on this page. [Show comments]
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki