|
PITS /
00266Summary: Last title encountered wins, it should be first title markup
Created: 2005-01-05 06:11
Status: Open
Category: CoreCandidate
From: Han
Assigned:
Priority: 543
Version: 2.0. beta14
OS: Mac OSX 10.3.7, Apache 2.0.52, PHP4.3.9
Description: When you use (:title:) on page A and (:include:) that page in page B, page B gets the title of page A. Same problem than PITS.00779. Maybe not strictly a bug, but it runs totally across intuition that a later title markup, for instance from an included page, will win over the first title markup. Authors will intuitively set a title markup at the page beginning, not the end! Cookbook.TitleMarkup shows a solution, but it ought to be in the core I think. - HansB July 04, 2008, at 12:55 PM Well, yes, one would expect that any directives in an included page (B) would affect the page that includes it (A). What should happen? Note that PmWiki uses the last Anyway, I'm not entirely sure this is a bug. Maybe. If you know that B's title directive is the first line of the file, you could always do With the latest 2.2.0 version of PmWiki, I've "solved" this problem by using the following conditional code in the include file. With 2.2.0 and the $EnableRelativePageVars turned on,
(:if name {$FullName}:)
(:title This is the title for the Include File:)
(:description This is the description for the Include File:)
(:ifend:)
Adding the following to config.php will define the title markup so that "the first title encountered wins", subsequent title directives (on included pages or otherwise) will be ignored:
## (:title ...:) First title wins, any subsequent (:title ...:) is ignored.
Markup('title','directives',
'/\\(:title\\s(.*?):\\)/ei',
"SetTitleMarkup(\$pagename, PSS('$1')) ");
function SetTitleMarkup($pagename, $arg) {
static $tset = 1;
if ($tset==1)
PCache($pagename, $zz=array('title' => SetProperty($pagename, 'title', $arg )));
$tset++;
}
HansB January 27, 2008, at 05:24 AM When there are multiple titles on a page (including included titles) the last one is the title displayed. From mailing list it is suggested that
|