[pmwiki-users] [Help] How to edit page by using Fox?

imoc blog.oc at gmail.com
Mon Jan 21 06:40:20 CST 2008


    Saturday, January 19, 2008, 6:04:24 PM, imoc wrote:

    > 3) Use Fox to open those pages in a way that every PTV got it's own
    >    editform and the text in a textarea;
    > 4) I can edit each PTV also the text separately;
    > 5) Saving/updating the changes to the target page.

    Install fox.php and foxedit.php.
    Put a foxedit link on the page, which calls a custom edit form, like:
       {[foxedit form=Group.MyPTVEditForm]}

    Create Group.MyPTVEditForm with this content, and then modify it to
    your needs:

    (:messages:)
    (:fox editform target={$EditTarget} ptvtarget={$EditTarget} template=0
redirect=1 :)
    (:input hidden csum 'page update':)
    (:input defaults source={$EditSource} :)
    || ||'''Edit Page: {$EditTarget}'''||
    || Var 1:||(:input text name=$:Var1 size=50:) ||
    || Var 2:||(:input text name=$:Var2 size=50:) ||
    || Var 3:||(:input text name=$:Var3 size=50:) ||
    || Text:||(:input textarea id=text name=$:text  cols=70 rows=10 :) ||
    (:if enabled EnableAccessCode:)
    || ||Enter value {$AccessCode} (:input text access size=3 class=inputtext:)
    (:input hidden accesscode {$AccessCode}:)  <- Have you entered the code
number?||
    (:if enabled EnablePostCaptchaRequired:)
    || ||Enter value {$Captcha} (:input captcha class=inputtext:) <- Have you
entered the code number?||
    (:if:)
    || Author:||(:input text author value='{$Author}' size=30 class=inputtext:)
    (:input submit post "Save":) (:input submit cancel "Cancel":) ||
    (:foxend editform:)


    This form has edit fields for page text variables Var1, Var2, Var3,
    text. Add more and rename as required, corresponding to the
    variables on your page. Note the syntax in the form fields for the
    PTVs is
             name=$:Variable

    The page text needs to be in a PTV called 'text', in order for it to
    appear in the textarea form field. Enclose the page text in anchors,
    and foxedit uses that as a PTV:

    [[#text]]
    text content
    ...
    ...
    [[#textend]]

    Some more explanations of the fox form:

    (:input defaults source={$EditSource} :) will load the variables from
    your target page, and not the form page.

    {$EditTarget} is your target page, i.e. the page with the foxedit link
    and your data, the calling page.

    ptvtarget={$EditTarget} - this enables the PTV updating on the target
    page.
    template=0 - we only update PTVs, so we are not using a template for
    adding content.
    redirect=1 - when the edit form loads, its page gets opened, even
    though the page title is the target page (the calling page). When the
    form is submitted, the redirect makes sure the target page is shown.

    (:input hidden csum 'page update':) - the value 'page update'  to appear
    in RecentChanges pages.

    Use the Accesscode or Captcha code lines as you need them, or delete
    them.

    Hope this helps!


      ~Hans
================================================

Hi Hans,

Many thanks for your detailed explanation. I've done the job perfectly.
I got a little problem that while all of the PTVs can be edit in the 
input field but I have no idea how to put the '(:title:)' in the same 
way for editing. Any ideas?

imoc







More information about the pmwiki-users mailing list