|
CustomLinksToCreatePage<< NoAuth | Cookbook-V1 | External links in new window >> Note: The recipes here are for PmWiki versions 0.6 and 1.0 only. For PmWiki 2.0 recipes, see Cookbook.
GoalThis recipe helps you replace the default '?' that appears after a link to a page that doesn't exist, with something else like '[Create]'. SolutionThe solution is simply to redefine the variable $WikiPageCreateFmt to your liking. Here's an example which you can add to your $WikiPageCreateFmt = "<span class='createlink'>\$LinkText</span><a ". "class='createlink' href='\$PageUrl?action=edit'>[Create]</a>"; You might also want to add something like the following to one of your style files (.css): A.createlink { font-size:64%; }
This class definition above will make the text Here is another example, where the link to create the page has also been given a title attribute. In many browsers the title is shown in a popup when you hold the mouse over the link, which in this case means that the user will get more information about what the link does. $WikiPageCreateFmt = "<span class='createlink'>\$LinkText</span><a ". "class='createlink' href='\$PageUrl?action=edit' title=". "'Use this link to create the page \"\$PageName\"'>[Create]</a>"; DiscussionRemember that there are typically two steps to doing this customization:
Tip: It looks pretty good if you place the "[Create]" as superscript, using the See AlsoThe implementation of this customization was discussed in this thread: http://thread.gmane.org/gmane.comp.web.wiki.pmwiki.user:5702 History2004-07-08: This page was created. Comments & BugsFor clarity, one can tweak the style files (.css) as follows: A.createlink {
font-size : 64%;
padding-left : 3px;
}
This will insert a 3-pixel space between the new Wiki page title and the [Create] label. Or, you might omit the styling and use To get the supescript and still be standards complient, it would be better to change the style above to something like this: A.createlink {
font-size : 64%;
vertical-align: super;
padding-left : 3px;
}
Rather than using the Or if you space wiki words, you might include the following: $WikiPageCreateSpaceFmt = str_replace('$LinkText','($LinkText)',
$WikiPageCreateFmt);
This will show a new page as (new page)? instead of new page? Contributorspmwiki-2.2.0-beta68 -- Last modified by {{vertigo25}}
|