Recent Changes - Search:

OTRR Wiki Home Page

Old Time Radio Researchers Group


FirstLines /
21stPrecinct
Firstlines /
Abbottandcostello
FirstLines /
AbbottAndCostello
AirAdventuresJimmieAllen
AldrichFamily
AllStarWesternTheatre
AmosAndy
ArchieAndrews
Blondie
BoldVenture
BoldVentureZIVSequence
BostonBlackie
Box13
BulldogDrummond
Contribs
Counterspy
DangerDoctorDanfield
DangerousAssignment
DangerousAssignmentBackup
DannyKayeShow
DeMarco
DimensionX
Firstlines /
Firstlines
FirstLines /
FredAllenFredAllenShow
FredAllenHourOfSmiles
FredAllenLinitBathClubRevue
FredAllenSaladBowlRevue
FredAllenSalHepaticaRevue
FredAllenShow
FredAllenShowOneLog
FredAllenTexacoStarTheater
FredAllenTownHallTonight
FrontierGentleman
GreatGildersleeveHaroldPeary
GreatGildersleeveWillardWaterman
Gunsmoke
HallsOfIvy
HaveGunWillTravel
HomePage
InnerSanctum
JackBennyProgram01
JackBennyProgram02
JackBennyProgram03
JackBennyProgram04
JackBennyProgram05
JonathanThomasChristmasOnTheMoon
LineUp
LukeSlaughter
LumAndAbner1
ManCalledX
MrMrsNorth
OnStage
OzzieAndHarriet
PatNovakForHire
ProudlyWeHail
RadioGOLDINdex
RichardDiamond
RichardDiamondPrivateDetective
RoguesGallery
StewartMessage
SuspensePartOne
SuspensePartTwo
TemplateScript
ThatHammerGuy
TheAdventuresOfSuperman
TheAdventuresOfSupermanPageEight
TheAdventuresOfSupermanPageFive
TheAdventuresOfSupermanPageFour
TheAdventuresOfSupermanPageOne
TheAdventuresOfSupermanPageSeven
TheAdventuresOfSupermanPageSix
TheAdventuresOfSupermanPageThree
TheAdventuresOfSupermanPageTwo
TheaterFive
TheCoupleNextDoor01
TheGreenHornet
TheGreenHornetPageFour
TheGreenHornetPageOne
TheGreenHornetPageThree
TheGreenHornetPageTwo
TheHallsOfIvy
TheManCalledX
TheSixShooter
VicAndSade
WildBillHickok
YouBetYourLife


CertFirstLines /
AddressUnknown
BabeRuthCollection
BarrieCraigConfidentialInvestigator
BarrieCraigConfidentialInvestigatorPage01
BarrieCraigConfidentialInvestigatorPage02
BarrieCraigConfidentialInvestigatorPage03
BarrieCraigConfidentialInvestigatorPage04
BarrieCraigConfidentialInvestigatorPage10
BarrieCraigConfidentialInvestigatorPage15
BarrieCraigConfidentialInvestigatorPage99
BarrieCraigConfidentialInvestigatorPageFooter
BehindTheScene
BigShow
BlackMuseum
BlairOfTheMounties
BlueBeetle
Box13
BrightStar
BroadwaysMyBeat
BroadwaysMyBeatFooter
BroadwaysMyBeatPage01
BroadwaysMyBeatPage02
BroadwaysMyBeatPage03
BroadwaysMyBeatPage10
BroadwaysMyBeatPage15
BroadwaysMyBeatPage99
CandyMatsonYukon28209
CaseDismissed
CavalcadeOfAmerica
CavalcadeOfAmericaPage01
CavalcadeOfAmericaPage02
CavalcadeOfAmericaPage03
CavalcadeOfAmericaPage04
CavalcadeOfAmericaPage05
CavalcadeOfAmericaPage06
CavalcadeOfAmericaPage07
CavalcadeOfAmericaPage08
CavalcadeOfAmericaPage10
CavalcadeOfAmericaPage15
CavalcadeOfAmericaPage99
CavalcadeOfAmericaPageFooter
CavalcadeOfKings
Chase
ChetChettersTalesFromTheMorgue
CinnamonBear
CloakAndDagger
ClydeBeattyShow
CrimeClassics
CruiseOfThePollParrot
DangerouslyYours
DangerWithGrainger
DarkFantasy
DayOfTheTraffids
DevilAndMrO
Dragnet
DragnetPage01
DragnetPage02
DragnetPage03
DragnetPage04
DragnetPage10
DragnetPage15
DragnetPage99
DragnetPageFooter
DrJekyllAndMrHyde
FalconTheAdventuresOfThe
FalconTheAdventuresOfTheFooter
FalconTheAdventuresOfThePage01
FalconTheAdventuresOfThePage02
FalconTheAdventuresOfThePage03
FalconTheAdventuresOfThePage04
FalconTheAdventuresOfThePage05
FalconTheAdventuresOfThePage06
FalconTheAdventuresOfThePage10
FalconTheAdventuresOfThePage15
FalconTheAdventuresOfThePage99
FamilyDoctor
FatMan
FatManFooter
FatManPage01
FatManPage02
FatManPage03
FatManPage10
FatManPage15
FatManPage99
FifthHorseman
FireFighters
FiveMinuteMysteries
FortLaramie
FrontierGentleman
GoodNewsOf
GreenValleyLine
HallsOfIvy
HallsOfIvyFooter
HallsOfIvyPage01
HallsOfIvyPage10
HallsOfIvyPage15
HelloAmericans
HillbillyBoys
HomePage
IncredibleButTrue
InTheNameOfTheLaw
ItSticksOutHalfAMile
LetGeorgeDoIt
LetGeorgeDoItFooter
LetGeorgeDoItPage01
LetGeorgeDoItPage02
LetGeorgeDoItPage03
LetGeorgeDoItPage04
LetGeorgeDoItPage10
LetGeorgeDoItPage15
LetGeorgeDoItPage99
LukeSlaughterOfTombstone
MayorOfTheTown
MrKeenTracerOfLostPersons
MrPresident
MysteryHouse
NeroWolfeTheNewAdventuresOf
Nightwatch
PhilipMarloweBBC
PhilipMarloweTheAdventuresOf
PhilipMarloweTheAdventuresOfFooter
PhilipMarloweTheAdventuresOfFootnote
PhilipMarloweTheAdventuresOfPage01
PhilipMarloweTheAdventuresOfPage02
PhilipMarloweTheAdventuresOfPage03
PhilipMarloweTheAdventuresOfPage10
PhilipMarloweTheAdventuresOfPage15
PhilipMarloweTheAdventuresOfPage90
PhilipMarloweTheAdventuresOfPage99
PhilipMarloweTheAdventuresOfSpecialNote
PhiloVance
PlanetMan
PoliceHeadquarters
PopeyeTheSailor
PrivateFilesOfRexSaunders
QuietPlease
RadioHallOfFame
RedBookDramas
RichardDiamondPrivateDetective
RockyFortune
SamSpadeTheAdventuresOf
SealedBook
SecretAgentK7
SecretsofScotlandYard
ShellChateau
SherlockHolmesConwayAndBruce
SherlockHolmesRathboneAndBruce
SilentMen
SixShooter
SkyKing
SmithsOfHollywood
StandByForCrime
StrokeOfFate
Whitehall1212
WorldAdventurersClub
YoursTrulyJohnnyDollar
YoursTrulyJohnnyDollarFooter
YoursTrulyJohnnyDollarPage01
YoursTrulyJohnnyDollarPage02
YoursTrulyJohnnyDollarPage03
YoursTrulyJohnnyDollarPage04
YoursTrulyJohnnyDollarPage05
YoursTrulyJohnnyDollarPage06
YoursTrulyJohnnyDollarPage07
YoursTrulyJohnnyDollarPage08
YoursTrulyJohnnyDollarPage09
YoursTrulyJohnnyDollarPage10
YoursTrulyJohnnyDollarPage11
YoursTrulyJohnnyDollarPage12
YoursTrulyJohnnyDollarPage99

Fmt Page Name


admins (advanced)

This page describes an internal function in PmWiki's engine called FmtPageName().
The contents are not intended for those with a weak heart
;-)

Also see: PmWiki.Functions

FmtPageName($fmt, $pagename)

Returns $fmt, with $variable and internationalisation substitutions performed, under the assumption that the current page is pagename. As a rule is used to pre-process all variables which by convention have a "Fmt" suffix (like $GroupFooterFmt), but also other strings that require interpolation, notably the page template (.tmpl) file. See PmWiki.Variables for an (incomplete) list of available variables, PmWiki.Internationalizations for internationalisation.

The function FmtPageName() applies internationalization-substitutions
and $Variable-substitions to the string $fmt under the assumption that the
current page is $pagename.

The substitutions go as follows:

  1. Replace any sequences of the form $XyzFmt with value of any corresponding global variable.
  2. Process the string for any $[...] phrases (internationalized phrase), using the currently loaded translation tables.
  3. Replace any instances of {$ScriptUrl} with $ScriptUrl (to defer processing to the URI processing phase)
  4. Replace any instances of standard Page Variables (beginning with an upper case letter, followed by at least one word character) with their values. Note that PVs of the form {Group.Page$Var} are not replaced. If there are no more $-sequences, then return the formatted string and exit the function
  5. Perform any pattern replacements from the array $FmtP. Typically this is used to handle things like $Name and $Group etc that are specific to the name of the current page. ?? Appears to be used in robots.php to hide actions from robots.
  6. Replace any remaining instances of Page Variables with their values. Note that these variables are in the form $Var rather than the usual PV form of {$Var}.
  7. If $EnablePathInfo isn't set, convert URIs to use the syntax $ScriptUrl?n=<Group>.<Name> instead of $ScriptUrl/<Group>/<Name>. In any case, replace $ScriptUrl with its value. If there are no more $-sequences, then return the formatted string and exit the function
  8. Replace any $-sequences with global variables (caching as needed) of the same name (in reverse alphabetical order, and filtering out any unsafe globals) *
  9. Replace any $-sequences with values out of the array $FmtV.

Note that FmtPageName() is automatically aware of any global
variables. However, since modifying global variables may be expensive, the
array $FmtV exists as a way to avoid rebuilding the variable cache for
values that change frequently.

Security

According to PM, as a general rule it's unwise to be calling FmtPageName() on strings that are coming from page markup, as this exposes the ability for people to view the values of variables that perhaps they shouldn't see. This is also why page variables (which come from markup) use PageVar() and PageTextVar() and don't go through FmtPageName().

Availability of Variables in FmtPageName

To be very specific, here's what Pm wrote regarding different ways of
defining a variable that can be used by FmtPageName (when it is formatting a
string):

  • Set a global variable. FmtPageName() automatically performs substitution on all global variables that aren't arrays. If the variable is going to change value over repeated calls to FmtPageName, it's probably better to use $FmtV as in the next item.
  • Set a value in the $FmtV array. $FmtV['$MyVariable']='something' means to replace instances of '$MyVariable' with 'something'. Use this for variables that change value frequently over multiple calls to FmtPageName.
  • Set a pattern/replacement in the $FmtP array. This is normally done for substitutions that have to be dynamic somehow based on the pagename being referenced, such as '$Title', '$Group', '$Name', '$PageUrl', etc.

Also see: Cookbook:Functions#FmtPageName

Finally, here's something else Pm wrote that is related and explains
why we have this function:

In order to produce its output, PmWiki has to do a variety of string substitutions:
  1. Generating the full name, group, title, or url of a page (other than the currently displayed page)
  2. Substituting the values of global variables
  3. Performing internationalization substitutions
  4. Converting $ScriptUrl/$Group/$Name to $ScriptUrl?n=$Group.$Name for sites that cannot handle PATH_INFO urls
  5. Other substitutions needed by specific functions
PmWiki centralizes all of that substitute-a-dynamic-value-in-a-string into the FmtPageName() subroutine. Because some things are extremely dynamic, such as the url or group for an arbitrary page that is not the current one, those things cannot be simple global PHP variables. Or, if they do become global variables, they're variables that cannot be trusted to hold a value for very long because some other routine (that may happen to be formatting a string for a different page) will come along and change that global variable for whatever it happens to be doing.
A limited set of $-substitutions -- basically anything that corresponds to a page attribute -- are not PHP variables and are only available through the FmtPageName() subroutine. The complete set of these special substitutions is $Group, $Name, $FullName, $PageUrl, $Title, $Titlespaced, $Namespaced, $Groupspaced, $LastModifiedBy, $LastModifiedHost, and $LastModified. These items cannot just be standard PHP variables because often PmWiki needs to obtain the url, name, group, title, etc. of a page other than the one currently being viewed by a browser.
At the moment, $Title, $LastModified, $LastModifiedBy, and $LastModifiedHost can only work if the page's attributes have been loaded and cached using the PCache function. So, to get at these values one must typically do:
$page = ReadPage($pagename);
PCache($pagename, $page);
$ptitle = FmtPageName('$Title', $pagename);
$pauthor = FmtPageName('$LastModifiedBy', $pagename);




This page may have a more recent version on pmwiki.org: PmWiki:FmtPageName, and a talk page: PmWiki:FmtPageName-Talk.

Edit - History - Print - Recent Changes - Search
Page last modified on September 10, 2011, at 10:08 AM