[pmwiki-users] Link to last visited page

Peter Bowers pbowers at pobox.com
Sat Feb 4 08:17:25 CST 2012

On Sat, Feb 4, 2012 at 10:06 AM, Martin Kerz <mkerz at me.com> wrote:
> can I somehow get the $FullName of the last visited page before the current one?
> I would love to have something like {<$FullName} in wikitrails. Has anyone ever done this? It would be necessary for a cancel button in a jquerymobile cancel dialog.

Here's one possibility -- maybe a bit ugly because it's visible to
users who look in the address, but at least it may be a start...

You could change the link format so that every link would always
append a ?prevpage=Mygroup.Mypage and then you would have access using
the appropriate $_GET['prevpage'].

I don't remember exactly how I accomplished changing the link format
(and I don't know whether it's the best way) but when I was doing my
PageHist recipe I changed all links so that they maintained a
?asof=<date> from page to page.  You can see how I did it by checking
out pagehist.php at http://www.pmwiki.org/wiki/Cookbook/PageHist.

Another option would be to simply set a value in $_SESSION each time
you load a page (you'll have to figure out where that can be done in
config.php in terms of when sessions are initialized - seems like I
had some trouble finding that point during some previous work but I've
forgotten the details).  You could keep a whole list of history (last
n pages) if you wanted to...  This has the benefit of not being
visible to the user.

HTH or at least gives some ideas that may get you started...


More information about the pmwiki-users mailing list