[pmwiki-users] Link to last visited page

Peter Bowers pbowers at pobox.com
Sat Feb 4 16:22:55 CST 2012


On Sat, Feb 4, 2012 at 3:42 PM, Martin Kerz <mkerz at me.com> wrote:
> I agree, the first option looks ugly. Alas, your second option seems too complicated for my limited php skills, although I perhaps will have to end up trying it if my following idea doesn't work.

It's potentially as easy as this:

if ($pagename != $_SESSION['currpage']) {
  $_SESSION['lastpage'] = $_SESSION['currpage'];
  $_SESSION['currpage'] = $pagename;
}

Then use the http://www.pmwiki.org/wiki/Cookbook/HttpVariables recipe
to use those session variables on a page (very similar syntax to a
PTV).

> My reasoning is the following:
>
> With pmwiki we have a perfect document based database using PTVs. So using FoxForms we could set a PTV containing the previous page name in a dedicated page. This way I could even use conditionals to prevent the setting of PTVs on e.g. dialogs (which basically are nothing more but wiki pages). Access would be more than easy using standard PTV markup.

What will you do if 2 people are browsing the site at the same time?
Create PTVs based on IP address?  Sounds like this gets pretty
complicated pretty quickly...  What if someone is browsing from 2
different sessions at the same time?  How do you keep their 2 sets of
history from getting mixed up?

I think you'll have a lot better luck with the $_SESSION variable...

-Peter



More information about the pmwiki-users mailing list