[Pmwiki-users] Publishing a WikiTrail (or a WikiBook)

John Rankin john.rankin
Sun Aug 3 20:40:49 CDT 2003

> 1. It would be nice to tell PmWiki that "if this page doesn't exist, 
> output the default text". Right now, if the page doesn't exist, it 
> outputs nothing, so I have to do a check for page existence and 
> either output "wiki:stoppage" or "Describe <a ... /a> here."
> The best idea I could come up with is 
>   wiki:page1 page2 ... ?

Could instead you do an array of 
   "wiki:page1 Main.PrintNonExistent", 
   "wiki:page2 Main.PrintNonExistent", 
   "wiki:page3 Main.PrintNonExistent",
The contents of Main.PrintNonExistent would then be displayed for any page
that didn't exist in the trail.  (Or is this what you're doing already?)

Yes, that was one of the options I considered. I tried doing
  "function:PrintText $DefaultPageTextFmt"
for non-existent pages, but $Tlink substitutes to the trail page, not the stop page.

So if I create a page called Main.PrintNonExistent the text would have to be fixed -- my guess is that I can't put (say) "Describe $Tlink here." as the text of that page, cos $Tlink won't come out as the stop page. In the end, to avoid tracking both the stop name and the stop link name, I introduced a variable with the value:

  $PublishCreatePageFmt = 'Describe <a href="$PageUrl?action=edit">$Titlespaced</a> here.';

and for nonexistent pages set:

  $PublishList[] = FmtPageName($PublishCreatePageFmt,$pages[$i]);

where $pages[$i] is the current stop page. If the page exists,

  $PublishList[] = "wiki:$pages[$i]";

So it all works, but it would be nice to use just the "wiki:page" syntax and have non-existent page text come out with a reference to the name of the page that doesn't exist. Hence my suggestion for writing:

  $PublishList[] = "wiki:$pages[$i] ?";

Then of course an administrator can redefine $DefaultPageTextFmt if required.

> 2. The <<|trail|>> and <|trail|> markup interpretation gets led astray. 
> Because $pagename is the name of the trail page, the trail markup returns 
> "<<|trail|>>" or "trail", unless the trail page is itself in the list. 
> I couldn't decide what was the best solution, so I made 2 adjustments to 
> the trails script.

Instead of adjusting the trails script, how about disabling the trail 
markups?  Just do

Alternately, you could use the $DoubleBrackets array to display the trail
markup however you wish.

Yes, redefining how trail markup is treated makes sense. Have a look at:

http://wiki.lianza.org.nz/index.php/KeyWords/Survey (a trail page)

http://wiki.lianza.org.nz/index.php/Research/DigitisationSurvey2001 (a research project page)

A research project can have several keywords and a keyword normally applies to several projects. I use the notify.php script to define a list of keywords for each research project and hence create each keyword page in RecentChanges format. In published form, we want the keyword list to appear, and in browse form, we want to treat the keyword list as a set of trails. 

I'll try just redefining $DoubleBrackets -- that is definitely easiest!


More information about the pmwiki-users mailing list