The public function getPageTitle already exists in OutputPage.php, search
it.
It contains only
return $this->mPagetitle;
Insert
wfRunHooks( 'GetPageTitle', array(&$this->mPagetitle ));
before "return"
2007/3/1, Paul Coghlan <pcoghlan(a)usa.net>et>:
Thanks Sylvain.
I THINK I followed what was needed.
I inserted the following line into LocalSettings.php:
Include("extensions/getPageTitle.php");
I also created the new getPageTitle.php from the code below within the
extensions folder.
I finally inserted the following lines into includes/OutputPage.php:
public function getPageTitle() {
wfRunHooks( 'GetPageTitle', array(&$this->mPagetitle ));
return $this->mPagetitle;
}
When I attempt to load any MW page I get an immediate white screen. If I
comment out the line in the LocaSettings.php all returns to normal?!
Any ideas on where I might have slipped up?
Paul
On 2/28/07 6:40 PM, "Sylvain Machefert" <iubito(a)gmail.com> wrote:
My hook is not for page footer, it's for
title on the top of the page.
The category box in the footer is mostly CSS.
The flags after the countries names is an old ugly hack I've made in the
code, I should convert it to a hook...
Here is my hook for the title of a page.
/extensions/getPageTitle.php :
$wgHooks['GetPageTitle'][] = 'nicePageTitle';
function nicePageTitle($pagetitle) {
#TEST : $pagetitle = strtoupper($pagetitle);
$img = '';
$imgEnd = '';
if (preg_match('#^Category:#ui', $pagetitle))
$img = 'category.gif';
//...other images if you want
if ($img != '') {
$pos = strpos($pagetitle, ':');
$alt = substr($pagetitle, 0, $pos+1);
$pagetitle = '<img src="/images/'.$img.'"
alt="'.$alt.'"
title="'.$alt.'" />'
. ' ' . substr($pagetitle, $pos+1);
if ($imgEnd != '')
$pagetitle .= ' <img src="/images/'.$imgEnd.'"
alt="" />';
}
I include it in LocalSettings, of course
and I call it in OutputPage :
public function getPageTitle() {
wfRunHooks( 'GetPageTitle', array(&$this->mPagetitle ));
return $this->mPagetitle;
}
2007/2/27, Paul Coghlan <pcoghlan(a)usa.net>et>:
>
> Thanks Sylvain.
>
> The [[:Category:foo|foo]] is OK for in-page links but for the list of
> categories in the page footer I think there is a need to use the hook
you
> mentioned.
>
> Can you post the hook here? I don't see how you call it and how you
> replace
> the category name with an icon which looks very good.
>
> Thanks,
> Paul
>
> On 2/27/07 3:53 PM, "Sylvain Machefert" <iubito(a)gmail.com> wrote:
>
>> If you make a link to [[Category:Foobar]] but only want to display
> "Foobar",
>> write this code :
>> [[:Category:Foobar|]] or [[:Category:Foobar|Foobar or what ever else
you
>> want]]
>>
>> If in the title of a page you want to hide the namespace
>> ("Category" or "User" or "User talk"...) you should
write a little and
>> simple hook.
>> You can see an example on my wiki :
>>
http://tousauxbalkans.jexiste.fr/Category:Pays
>> the word "Catégorie" (french for "Category") is replaced by
an icon.
>>
>> 2007/2/27, Paul Coghlan <pcoghlan(a)usa.net>et>:
>>>
>>> Kasimir
>>>
>>> Where in Mediawiki can you prevent inclusion of the namespace in the
> page
>>> title?
>>>
>>> I see there is an extension called DynamicPageList
>>> (
http://meta.wikimedia.org/wik/DynamicPageList) which appears to
> provide
>>> this but it isn't clear how.
>>>
>>> Thanks,
>>> Paul
>>>
>>>
>>>
>>> On 2/26/07 4:32 PM, "Kasimir Gabert" <kasimir.g(a)gmail.com>
wrote:
>>>
>>>> Hello Fernando,
>>>>
>>>> If I understand your problem correctly, then you could achieve the
>>>> same effect by using namespaces. Put all pages that are for "this
>>>> client" in "This client:Person form", and then do not show
the
>>>> namespace in the page title.
>>>>
>>>> I hope that this helps,
>>>> Kasimir
>>>>
>>>> On 2/26/07, Fernando Correia <fernandoacorreia(a)gmail.com> wrote:
>>>>> What is the best place to customize the way page titles are
> displayed?
>>>>> I'd like to customize the page title on the main article view,
and
>>>>> also on the page listing within a category.
>>>>>
>>>>> The reason is that we have several pages with conflicting names
like
>>>>> "Person form (This
client)" and "Person form (That client)" and
we'd
>>>>> like to show just
"Person form".
>>>>>
>>>>> The full page title will remain effective, used in link and
listings
>>> like Search and Recent changes.
>>>
>>> But it would be confusing for users of "This client" if all pages
>>> related to them were shown with "This client" appended.
>>>
>>> I wonder if anyone already solved this... Any hint will be
appreciated.
>>>
>>> _______________________________________________
>>> MediaWiki-l mailing list
>>> MediaWiki-l(a)lists.wikimedia.org
>>>
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>>>
>>
>
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l(a)lists.wikimedia.org
>
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
_______________________________________________
MediaWiki-l mailing list
MediaWiki-l(a)lists.wikimedia.org
http://lists.wikimedia.org/mailman/listinfo/mediawiki-l