+ Reply to Thread
Page 2 of 2 FirstFirst 1 2
Results 11 to 14 of 14

Thread: How to work with Template:Mindtouch/Control template commands?

  1. #11

    Default

    Thanks for your concern.

    Thats true, I got confused myself in what I want. What I actually want to do is completely different from the question I formerly asked.

    This is a brief scenario:
    I am in page A in my WIKI, and I asked the User to give me the URL of page B in the WIKI. What I want to do is call a template using the URL given as parameter. The problem is: the user enters the value on the client side, so I can't call the template using dekiscript.
    Question: I want to call this template in javascript (JEM), and what came first in my mind is using the URL form.

    If want any more details, I will be glad to share them with you.

    Thanks again

  2. #12
    Join Date
    Mar 2008
    Posts
    1,630

    Default

    The way this is typically handled is:
    1. Enter user data in an <input> field
    2. "Submit" the data back to the same wiki page
    3. Check for the presence of the arg data in the URL. If it's there, execute the desired code.

    So, for your case, let's call the argument "pageuri". Let's start with #3:
    Code:
    if (__request.arg.pageuri is not nil) {
        // DekiScript using pageuri, e.g.: mytemplate(pageuri);
    }
    else {
        // This gets executed when you first load the wiki page, *without* the argument
    }
    Here's a super-simple way of implementing #1 and #2:
    Code:
    <form>
        <input type="text" name="pageuri"/>
        <input type="submit"/>
    </form>;
    Of course, you're welcome to do something fancier with JEM, input validation, whatever. But this should get you started.
    [/code]

  3. #13
    Join Date
    Jan 2011
    Posts
    49

    Default

    Great thank you neilw! You've save several hours of work

    Thus, a little thing is wrong with your code, "arg" is missing an "S", the call to the parameters passed by URL is actually :
    __request.args.pageuri and not __request.arg.pageuri

    Please confim that i'm right

    Thank you

  4. #14
    Join Date
    Mar 2008
    Posts
    1,630

    Default

    Yes, you are correct. I frequently get that wrong. I actually thought about it while I was typing it, but convinced myself the "s" wasn't necessary. But it is.

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts