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 

P
PageAdminAction [PageAdminAction] . . . . Owner: DarTar
PageAdminPrune [PageAdminPrune] . . . . Owner: NickDamoulakis
PageAdminTest [PageAdminTest] . . . . Owner: DarTar
PageAndCategoryDivisionInACategory [Division between Pages and categories in a Category] . . . . Owner: NilsLindenberg
PageCloaking [PageCloaking] . . . . Owner: BrianKoontz
PagedComments [PagedComments] . . . . Owner: DarTar
PageDeletionInfo [PageDeletionInfo]
PageDeletionInfoFR [PageDeletionInfoFR] . . . . Owner: PivWan
PageEncryption [PageEncryption] . . . . Owner: ChristianBarthelemy
PageForCategoryTemplate [PageForCategoryTemplate] . . . . Owner: JavaWoman
PageHeadings [PageHeadings] . . . . Owner: GmBowen
PageHistoryInfo [PageHistoryInfo]
PageHistoryInfoFR [PageHistoryInfoFR] . . . . Owner: PivWan
PageIndex [PageIndex]
PageindexActionInfo [PageindexActionInfo] . . . . Owner: NilsLindenberg
PageIndexByLetterSuggestion [PageIndexByLetterSuggestion] . . . . Owner: JavaWoman
PageIndexNotesPatch [PageIndexNotesPatch] . . . . Owner: BrianKoontz
PageNamingConvention [PageNamingConvention] . . . . Owner: NilsLindenberg
PageOwnership [PageOwnership]
PageOwnershipFR [PageOwnershipFR] . . . . Owner: PivWan
PagesForUser [PagesForUser] . . . . Owner: IntElf
PageStatsAction [PageStatsAction] . . . . Owner: DennyShimkoski
PageWatches [PageWatches] . . . . Owner: DreckFehler
PanDancer [PanDancer] . . . . Owner: PanDancer
PanoPtis [PanoPtis] . . . . Owner: PanoPtis
ParentAction [ParentAction] . . . . Owner: DennyShimkoski
PascalHendrikx [PascalHendrikx] . . . . Owner: PascalHendrikx
PasswordForgotten [PasswordForgotten]
PatternValidColorInfoFR [PatternValidColorInfoFR] . . . . Owner: DotMG
PavanYeluri [PavanYeluri] . . . . Owner: PavanYeluri
PedroMiramis [PedroMiramis] . . . . Owner: PedroMiramis
PeeJay [PeeJay] . . . . Owner: PeeJay
PersPi [PersPi] . . . . Owner: PersPi
PeterPike [PeterPike] . . . . Owner: PeterPike
PeterStrand [PeterStrand] . . . . Owner: PeterStrand
PetteRi [PetteRi] . . . . Owner: PetteRi
PezHore [PezHore] . . . . Owner: PezHore
PgpTag [PgpTag] . . . . Owner: PgpTag
PhilippAHartmann [PhilippAHartmann] . . . . Owner: PhilippAHartmann
PhilippeVincent [PhilippeVincent] . . . . Owner: PhilippeVincent
PHP [PHP] . . . . Owner: DarTar
PhpMyEdit [PhpMyEdit] . . . . Owner: JsnX
PhPMyEditDiscussion [PhPMyEditDiscussion] . . . . Owner: NilsLindenberg
PhpShortOpenTags [PhpShortOpenTags] . . . . Owner: FrankSchenk
PhpWiki [PhpWiki] . . . . Owner: BrianKoontz
PhraseList [PhraseList] . . . . Owner: GregorLindner
PicasaAction [PicasaAction] . . . . Owner: RaffaR
PieDeAtleta [PieDeAtleta] . . . . Owner: PieDeAtleta
Pierre79 [Pierre79] . . . . Owner: Pierre79
PierreGorissen [PierreGorissen] . . . . Owner: PierreGorissen
PierreMareschal [PierreMareschal] . . . . Owner: PierreMareschal
PietroSperoni [PietroSperoni] . . . . Owner: PietroSperoni
PingpongBlog [PingpongBlog] . . . . Owner: ThomasSalomon
PivWan [PivWan] . . . . Owner: PivWan
PLG-Csv [CSV 2 Table formatter] . . . . Owner: ThePLG
PluginDirectory [PluginDirectory] . . . . Owner: DarTar
PluginsInDevelopment [PluginsInDevelopment]
PLUM [PLUM] . . . . Owner: MeiJianFang
PollSystem [PollSystem] . . . . Owner: ChristianBarthelemy
PolSara [PolSara] . . . . Owner: PolSara
PolVazo [PolVazo] . . . . Owner: PolVazo
PopOutSideMenu [PopOutSideMenu] . . . . Owner: GmBowen
PortableWikka [PortableWikka] . . . . Owner: PezHore
PostNuke [PostNuke] . . . . Owner: BrianKoontz
PradeepKishoreGowda [PradeepKishoreGowda] . . . . Owner: PradeepKishoreGowda
PreFormatter [PreFormatter] . . . . Owner: IanAndolina
PrettyCategory [PrettyCategory] . . . . Owner: RichardMartinNielsen
PrettyRecentChanges [PrettyRecentChanges] . . . . Owner: RichardMartinNielsen
PreventLongTags [PreventLongTags] . . . . Owner: DreckFehler
ProbaOldal [ProbaOldal] . . . . Owner: BertalanTamas
ProblemSolving [ProblemSolving] . . . . Owner: ProblemSolving
ProblemsWithModRewrite [ProblemsWithModRewrite] . . . . Owner: NilsLindenberg
ProgrammingHelp [ProgrammingHelp]
PseudoFormatters [PseudoFormatters] . . . . Owner: DarTar
PsiGnosis [PsiGnosis] . . . . Owner: PsiGnosis
PukoMuko [PukoMuko] . . . . Owner: PukoMuko
PuppyWikiAdmin [PuppyWikiAdmin] . . . . Owner: PuppyWikiAdmin
pyk [pyk] . . . . Owner: TestPik



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