+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 14

Thread: PHP Thingamajig example

  1. #1
    Join Date
    Oct 2007
    Posts
    141

    Default PHP Thingamajig example

    Hey, RoyK!

    I'm embarking on writing an extension in PHP. I'm trying to use your "PHP Thingamajig", which I found here...
    http://wiki.opengarden.org/index.php...HP_thingamajig

    Before I try to figure out what is wrong with my code, I'm trying to just get your simple "Hello, <string>" example to run.
    I've setup this service and haven't changed anything from the provided example (with the exception of the URI setting in index.php).

    When I try to call this in a wiki page, like this...
    Code:
    {{ reference.hello('fred') }}
    I get this returned...
    Code:
    Function 'reference.hello' failed with response:
    resource not found
    Any ideas?

    -Michael

  2. #2
    Join Date
    Feb 2007
    Posts
    1,871

    Default

    hey there michael,

    wow, really using 'search' on wiki.og, aren't you that thing is so antiquated!

    where did you set-up the PHP script? there are issue when you set it up on the same server as the wiki (due to the way apache is reading URLs). if you have access to a remote server, you may want to set it up there instead.

  3. #3
    Join Date
    Oct 2007
    Posts
    141

    Default

    It is setup on the same server, but I'm using a different virtual host.

    So, are you saying that this error message indicates that it is a URL issue? From the rewrites? I'll look into it. (I really want to keep this on the same box. I mean, I don't want to spread my wiki stuff out all over the place. That would make for a... "unprofessional deployment".)


    Antiquated, huh? Hrmm. I thought this was a perfect, simple little framework for what I wanted to do. I'm not hip on how to do anything in .NET. I can swing PHP and any kind of scripting language that I can mash up in notepad. Do you have any suggestions for doing a simple custom extension another way that might not be so antiquated?

    -Michael



    PS. I'm trying to write a custom extension to provide the functionality discussed here...
    http://forums.opengarden.org/showthread.php?t=1587
    It's also where someone pointed me to your php framework thingie.
    (It's really important to my team that we be able to parse the contents of another page.)
    Last edited by mhoydis; 01-15-2008 at 02:12 PM.

  4. #4
    Join Date
    Feb 2007
    Posts
    1,871

    Default

    No, it's perfectly fine to use that

    I'm guessing the issue is with mod_rewrites. The error message isn't one that comes up from miscommunication between deki wiki and extension - it's more of a generic error message. I'd try to find out what URL the extension is using (apache logs perhaps?) and work from there.

  5. #5
    Join Date
    Jan 2008
    Posts
    38

    Default

    Have you had any luck on getting the sample to work?
    I am stuck at
    <library> is an unsupported type

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

    Default

    Check out the new XML-based way to write extensions:
    http://wiki.opengarden.org/Deki_Wiki..._DekiScript%3f
    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

  7. #7
    Join Date
    Jan 2008
    Posts
    38

    Default

    I have followed the guide, and I am now stuck at this
    Code:
    reference to undefined name 'sample'
    Here is my extension...pulled from the service link in the control pannel.
    Code:
    <extension>
    <title>Test Sample</title>
    <description>hi mom</description>
    <label>Test</label>
    <namespace>sample</namespace>
    <uri.help>http://cow</uri.help>
    −
    	<function>
    <name>hi</name>
    <description>hi</description>
    −
    	<return type="html">
    −
    	<html>
    <head/>
    <body>hello</body>
    <tail/>
    </html>
    </return>
    </function>
    </extension>
    I am using 1.9.0, and it will show up in that cool new extensions button (LOVE IT), but it will not work if added that way, or manually.

    Any suggestions?
    Eric

  8. #8
    Join Date
    Feb 2007
    Location
    San Diego, CA
    Posts
    733

    Default

    Your extension looks good - I was able to run it.

    When you r egister the service, verify the following:
    - The service is r egistered as Local->Extension (not Local->Authentication)
    - The SID is set to http://services.mindtouch.com/deki/d.../12/dekiscript
    - The following config key is set: manifest=<path>, where <path> is the location of your extemsion.

    Assuming that the service r egisters without any errors, you should be able to invoke it using {{ sample.hi() }}.

  9. #9
    Join Date
    Jan 2008
    Posts
    38

    Default

    In frustration, I deleted the service I created, recreated it and it still did not work. Then I rebooted the server and it started to work.

    However, now it has stopped working. I have not touched the services, or edited my file. Any suggestions?

    (I rebooted the vm again, and it is currently working again 3rd time)
    Eric

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

    Default

    Don't use type="html". Just paste this and it should work:
    Code:
    <extension>
        <title>Test Sample</title>
        <namespace>sample</namespace>
        <function>
            <name>hi</name>
            <return>
                <html>
                    <body>hello</body>
                </html>
            </return>
        </function>
    </extension>
    I also removed everything that is optional to keep it simple.
    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