Extension talk:PageTrail

From MediaWiki.org
Jump to navigation Jump to search

Enable PageTrail globally[edit]

I wanted to enable PageTrail globally for a whole wiki, but I didn't find some means provided already by PageTrail to do this. Is there something that I missed? My solution was to edit the PageTrail.body.php so that there is now

 22                 global $wgUser, $wgPageTrailGlobalEnable;
 23 
 24                 if($wgPageTrailGlobalEnable) $this->enable = true;
 25                 else $this->enable = $wgUser->getOption('page_trail') != 0;

instead of

 22                 global $wgUser;
 23 
 24                 $this->enable = $wgUser->getOption('page_trail') != 0;

so one can globally enable PageTrail by setting

$wgPageTrailGlobalEnable = true;

in the LocalSettings.php

If there is not yet another means to do that already provided by PageTrails, I would suggest to implement this as a standard feature (if there is no other reason not to do so).

best regards, --Bin!johnny 19:01, 14 March 2008 (UTC)


hi bin!johnny / jean-lou,

I agree that enabling PageTrail by default is a great idea. However, if $wgPageTrailGlobalEnable is set, users won't be able to turn Pagetrail off for themselves ... It is either:

  • having PageTrail enabled globally and disallowing the users to turn it off xor
  • using jean-lou's default solution: users need to enable PageTrail explicitly in theier preferences.

Both solution are not optimal, as far as i'm concerned. What about an opt-out solution? Like this:

  • PageTrail is enabled by default and
  • users will be able to turn it off if they don't want to use it

To implement this, I changed

 22                 global $wgUser;
 23 
 24                 $this->enable = $wgUser->getOption('page_trail') != 0;

in PageTrail.body.php to

 22                 global $wgUser, $wgPageTrailGlobalEnable;
 23                 $this->enable = ($wgPageTrailGlobalEnable &&
 24                                  $wgUser->getOption('page_trail') == 0);

and

 10        'tog-page_trail'                => 'Use Page Trail',

in PageTrail.i18n.php to

 10        'tog-page_trail'                => 'Omit Page Trail',

I admit that double negations suck :-) Thoralf 13:51, 2 September 2008 (UTC)

Thanks Thoralf, your opt-out-solution seems much better to me. As I wanted PageTrail enabled by standard just for logged-in users on a new site, I now changed your line in PageTrail.body.php from:
   22                 global $wgUser, $wgPageTrailGlobalEnable;
   23                 $this->enable = ($wgPageTrailGlobalEnable &&
   24                                  $wgUser->getOption('page_trail') == 0);
to:
   22                 global $wgUser, $wgPageTrailGlobalEnable;
   23                 $this->enable = ($wgPageTrailGlobalEnable &&
   24                                  $wgUser->isLoggedIn() &&
   25                                  $wgUser->getOption('page_trail') == 0);
It works fine for me now, but probably in this case a more nifty solution would be to stay with the original "Use Page Trail"-option and set it to "1" by standard at account creation time. Right now I'm not into it, because of time constraints, but probably somebody else? --Bin!johnny 23:56, 19 February 2009 (UTC)

position of PageTrail[edit]

In its current incarnation, the PageTrail-div is placed absolutely at the bottom of a page. Unfortunately, it partly overlaps content at this place - for instance the borders of Category: boxes. Is there any way to prevent this opverlapping? I fiddled around with the css in PageTrail.body.php, but couldn't find a reliable solution ... Thoralf 14:29, 2 September 2008 (UTC)

CSS is far from my forte... if anybody finds a good solution, I'll be more than happy to update the extension. Until then... Jean-Lou Dupont 14:33, 2 September 2008 (UTC)

CSS and Style Changes:[edit]

This is what I did to improve the rendering of Page Trail. Essentially, I moved the page trail to the top, removed the coloring, and remove the word 'Page Trail'. The div is not positioned absolutely so there are no issues with content being covered. This more closely mimics the conventional behavior of web site bread crumbs.

Patch for for version 1.0.5 of PageTrail.body.php follows. You might need to do something about those errant line endings.

--- /tmp/old_pagetrail  2008-11-30 21:49:13.000000000 -0500
+++ /usr/share/php/MediaWiki/PageTrail/PageTrail.body.php   2008-11-30 21:49:48.000000000 -0500
@@ -52,11 +52,9 @@
 '<style type="text/css">^M
    #PageTrail {^M
     font-size:0.8em;^M
-    background-color: #FFFFCC;^M
-    position:absolute;^M
-    left: 2px;^M
-    bottom:0;^M
-    width:99%;^M
+    margin-top:10px;^M
+    margin-left:-10px;^M
+    text-align:left;^M
 </style>';^M
        ^M
            $op->addScript( $style );^M
@@ -95,7 +93,7 @@
  ^M
        $m_skin =& $wgUser->getSkin();^M
 ^M
-       $line = "<div id='PageTrail'> <i>Page Trail:</i> ";^M
+       $line = "<div id='PageTrail'>";^M
 ^M
        if ( !empty( $trail ))^M
            foreach( $trail as $index => &$e )^M
Thanks for the patch. Works much better for me now, and it does not overlap text, as it did before. Anyway, I still use "Trail: " at the beginning of the line to indicate what it is as I don't know if it is clear to users anyway. --Bin!johnny 23:59, 19 February 2009 (UTC)

trail not recorded when user is logged out[edit]

I think this is a nice extension, just to keep track of where you were when browsing around on a wiki. I installed it on my wiki (Wiki 1.12.4, php 5.2.9) and it works fine as long as you are logged in to the wiki. As soon as you clear your cookies in your browser and you are logged out the page trail will only show the page where you are at the moment but not the history pages visited before after log out. Is there any way to solve that? --Albert Ke 23:41, 12 May 2009 (UTC)

Example wiki?[edit]

Can anyone provide a link to a wiki where this is used? Tisane 08:27, 29 March 2010 (UTC)

Does it work with current versions of MediaWiki, and is there an easier way to get ahold of the code?[edit]

Tisane 10:12, 29 March 2010 (UTC)

Just fixed it for 1.19 : Change Line 103 to:
				$line .= Linker::link( Title::newFromText($e) );