We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37550 ☆ A M B ☆
    • 711 Posts
    Hi,

    I’m currently modding a plugin for fck editor which allows you to add to create links to site documents, what is the best way to start the MODx API on an external php file?

    At the moment i have copied index.php and changed the line which executes the modx parser


    // execute the parser
    $modx->aexecuteParser();

    Then I have copied part of the executeparser() function in this file

    \manager\includes\document.parser.class.inc.php

    and created this function:


    function aexecuteParser() {
    //error_reporting(0);
    if (version_compare( phpversion(), "5.0.0", ">=" ))
    set_error_handler(array(&$this,"phpError"), E_ALL);
    else
    set_error_handler(array(&$this,"phpError"));

    $this->db->connect();

    // get the settings
    if(empty($this->config)) {
    $this->getSettings();
    }
    }

    I guess theres a better way to do this, but I can’t work out how to do it, I know doing it like this will lead to problems in the future, any help would be much appreciated and once I have removed the above mess i will release the fckeditor plugin which allows you to create hyperlinks to internal modx documents via the menu. smiley

    A screen shot is attached so you can see how it will work.

    Thanks
    Aaron

      http://www.onesmarthost.co.uk
      UK MODX Hosting with love.
      • 22815
      • 1,097 Posts
      You said Quote from: awardle at Jul 31, 2006, 05:55 PM

      what is the best way to start the ebay API on an external php file?
      I took the liberty of correcting the slip to MODx API in your post so that people don’t get confused.

      It looks great. If you have a contribution that you feel needs further tweaking before it can be properly released, please post it in the Module, Plugin & Snippets In Development forum. That way people can see exactly what the code is doing and advise accordingly.
        No, I don't know what OpenGeek's saying half the time either.
        MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
        Forum: Where to post threads about add-ons | Forum Rules
        Like MODx? donate (and/or share your resources)
        Like me? See my Amazon wishlist
        MODx "Most Promising CMS" - so appropriate!
        • 32963
        • 1,732 Posts
        Hi Aaron,

        Very nice indeed. You might also want have at this library:
        http://modxcms.com/MODxAPI-Library-0.1-867.html

        Sure hope it can help.

        It;s very easy to use:
        include_once($path.'modxapi.php');
        $modx = new MODxAPI();
        $html = $modx->executeDocument(3);
        echo $html;
          xWisdom
          www.xwisdomhtml.com
          The fear of the Lord is the beginning of wisdom:
          MODx Co-Founder - Create and do more with less.
          • 22815
          • 1,097 Posts
          Now there’s service. Aaron comes on asking for the best way to start the MODx API from an external file, and within 30 minutes a very helpful API library is added to the Repo by xwisdom.

          And for the rest of us: a helpful library AND soon a much-wanted addition. Yay.
            No, I don't know what OpenGeek's saying half the time either.
            MODx Documentation: The Wiki | My Wiki contributions | Main MODx Documentation
            Forum: Where to post threads about add-ons | Forum Rules
            Like MODx? donate (and/or share your resources)
            Like me? See my Amazon wishlist
            MODx "Most Promising CMS" - so appropriate!
            • 37550 ☆ A M B ☆
            • 711 Posts
            Wow! grin

            Such a quick response I’ve Downloaded the files and tested them out they work a treat currently setting the path as:

            $path = "c:\domains\spcs.eu\wwwroot/";
            include_once($path.’modxapi.php’);

            Will have to get my thinking cap on so that it can auto get the path it self smiley

            Apart from that just need to tidy up the code, and hopefully will have it posted by the end of the day.

            Thanks for the library xwisdom

            Aaron
              http://www.onesmarthost.co.uk
              UK MODX Hosting with love.
              • 33337
              • 3,975 Posts
              Will this plugin add links as [~xxxx~] form ?

              Thanks.

              zi
                Zaigham R - MODX Professional | Skype | Email | Twitter

                Digging the interwebs for #MODX gems and bringing it to you. modx.link