|
Cookbook /
RemoveQuestionMarkSummary: How to remove question mark beside links for non-existent pages
Version:
Prerequisites:
Status:
Maintainer:
Categories: Links
QuestionHow do I get rid of that blasted question mark beside links for non-existent pages? AnswerSite-Wide RemovalIf you simply want the remove the question mark but you want the link to continue to point to the edit-page, then add the following to your local/config.php: $LinkPageCreateFmt = "<a class='createlinktext' href='\$PageUrl?action=edit'>\$LinkText</a>"; If you want links to non-existent pages to link to the page, but without the edit action, then add the following to your local/config.php: If you want links to non-existent pages to not render as links at all, then use the following in local/config.php: Group-Wide RemovalIf you want all links to non-existent pages in specific groups (even when linked to outside of these groups), to continue to link to the non-existent page, and to not link to the edit-page, you will have to patch your pmwiki.php. Add $LinkPageGroupEdit to the globals in the LinkPage() function: global $QueryFragPattern,$LinkPageExistsFmt,$LinkPageSelfFmt,
$LinkPageCreateSpaceFmt,$LinkPageCreateFmt,$FmtV,$LinkTargets,
$LinkPageGroupEdit;
And change the following line in the LinkPage() function from: if (!PageExists($tgtname) && !preg_match('/[&?]action=/', $qf))
to: $cr = ! PageExists($tgtname);
if ($cr) {
$grp = FmtPageName("\$Group", $tgtname);
if (isset($LinkPageGroupEdit[$grp]))
$cr = $LinkPageGroupEdit[$grp];
}
if (! $cr)
$fmt = ($tgtname==$pagename && $qf=='') ? $LinkPageSelfFmt
: $LinkPageExistsFmt;
elseif (!preg_match('/[&?]action=/', $qf))
Now you can assign the groups for which you which edit-page linking to be disabled in your local/config.php. Simply add the group to the $LinkPageGroupEdit[] array and set the value to FALSE. i.e. $LinkPageGroupEdit["Category"] = FALSE; It is not uncommon for the Category group to have many pages which are linked to, but which do not actually exist. You may want to treat them as if they do exist since they will be linked to, and they will probably actually display some content due to a pagelist directive in the GroupHeader or GroupFooter. This type of modification can also be very usefull for other groups besides the Category group. If your site has special groups which make use of the GroupHeader or the GroupFooter to provide the entire contents a of page, then you will have a group with almost all non-existant pages for which you may wish to apply this recipe. This technique allows an entire group of pages to be replicated with a different look, or with more or less data than the pages in the original group. Specific Instance Removal:Define a style and include it in your local/config.php: Now use Note: In this case, the omit-quest only removes the question mark, the edit-page link is retained.
Additional Notes:If you are using mostly empty groups such as described in the Group-Wide section, you may also be interested in modifying your Site.PageNotFound to eliminate warning messages for this group. i.e. (:if ! group special_group :)
Normal PAgeNotFound Contents
(:if:)
Or, you could allow a Group.PageNotFound, in local/config.php add: $DefaultPageTextFmt = '(:include {$Group}.PageNotFound {$SiteGroup}.PageNotFound:)';
This uses PageNotFound in the current group if it exists, otherwise it uses Site.PageNotFound. See AlsoContributorsNotes and CommentsI can't seem to get the question mark to go away in version 2.2.0-beta57 --DavidBessler |