+ Reply to Thread
Results 1 to 4 of 4

Thread: Problem with extension and other questions

  1. #1

    Default Problem with extension and other questions

    First, let me say that I am using DekiWiki VM and I just recently updated it to 1.8.3c. I use this at home for storing role playing game information and I find it to be one of the best wiki applications I have found. But on to my questions.

    I want to use parameterized templates to have a standard way of displaying fields of information. One piece of information I want to display as part of this template is a thumbnail of an attached image. So first question is there a way, through Dekiscript or otherwise, that I can get the URI of an attached image without having to first insert it into the page? I was unable to find anything to do this so I then attempted to build the "src" attribute dynamically, but when I tried to use Dekiscript in the template, like this:

    <img src="{{ args.image}}" />

    it did not work. Nor did it work if I tried to build the "src" attribute dynamically through appended text nor did it work when I tried to build the entire img tag through appended text.

    So I tried my hand at building an XML extension, thinking this might be the better way to go. So my first attempt was to follow the Dekiscript examples here on opengarden.org. I registered the service but received the following error "Argument cannot be null. Parameter name: doc" and the service is always disabled, no matter what I do to refresh or update it.

    Anyway, sorry this was so long, but I hope there is enough information here for someone to help me out.

    Thanks in advance for any assistance.
    Kevin F.

  2. #2
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    There is a built-in function for embedding images:
    {{ web.image(args.image) }}

    The deki-script interpreter for XML extensions is more flexible, but you need to be careful that you don't have badly formed XML.

    So, the same could be accomplished in an extension with the following code:
    Code:
    <html xmlns:eval="http://mindtouch.com/2007/dekiscript">
        <body>
            <img eval:src="args.image" />
        </body>
    </html>
    The "eval:" prefix indicates to the execution engine that you want that attribute evaluated and thus the contents of the attribute is interpreted as code instead of a value.

    The mechanism is somewhat described in the FAQ, but it's not complete. I'll gladly answer any questions you may run into on this thread.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

  3. #3

    Default

    Thanks for the reply, I can't seem to get any XML extension, that I add, to work so I think I will skip this for now and come back to it later.

    I tried embedding the script {{ wiki.image("myimage.jpg") }} directly in the page, avoid the template as well to keep it simple, but this did not work either. The problem is the format of the URI, it needs to use the APIs to get the file. Is there a way, using Dekiscript, to properly format the URI?

    Thanks again for the help.
    Kevin F.

  4. #4
    Join Date
    Jul 2006
    Location
    San Diego, CA
    Posts
    5,450

    Default

    Right click on the image and select "Copy Link", then paste it into your code.
    Steve G. Bjorg - Chief Architect
    Did you check the MindTouch FAQ?
    Found a bug? Report it.
    Follow me on Twitter
    Find us on IRC: irc.freenode.net #mindtouch

+ Reply to 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