[pmwiki-devel] page content shows on wrong page

Patrick R. Michaud pmichaud at pobox.com
Wed May 2 11:36:20 CDT 2007

On Wed, May 02, 2007 at 05:23:07PM +0100, Hans wrote:
> Wednesday, May 2, 2007, 4:25:59 PM, Patrick wrote:
> > I think the action= value of the form should be {$PageUrl}
> > instead of {$ScriptUrl}.  That way if the post fails,
> > the user is correctly placed on the page that contained
> > the form and not Main.HomePage.
> Yes, but I am failing to get the right php code for this.
> The (:fox ..:) markup defines for output
>  "<form action='$ScriptUrl' method='post' ".
>   ....
> If I change the above $ScriptUrl to $PageUrl (and declare global $PageUrl)
> I get action='' in the HTML output.
> If I use
>   "<form action='{$PageUrl}' method='post' ". ....
> or
>  "<form action='".$PageUrl."' method='post' ". ....
> I don't get an action either. So I have not learned how to insert the
> variable. Why does $ScriptUrl work fine inside the markup function,
> but $PageUrl is not? 

Because $PageUrl is a *page variable*, not a global variable.
In order to determine the url of a page, we have to know the
name of the page (which might not be the same as the currently
displayed page).

To get the value of a page variable, use PageVar():

   "<form action='" . PageVar($pagename, '$PageUrl') . "' ... "


More information about the pmwiki-devel mailing list