Announcement

Collapse
No announcement yet.

Include a 3rd party API within Scriptcase Project

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Include a 3rd party API within Scriptcase Project

    I want to use a 3rd party API called rocketship.it so I can do address validation.
    Its a folder with a bunch of PHP code and All I need to do is
    Code:
    require 'autoload.php';
    And then reference the object within my PHP code.

    Being new to scriptcase I am wondering what is the best way to do this?
    Please spell it all out for me... how should I include this additional folder and files into my project and publish it etc?

    Thanks!

  • #2
    create a custom directory like _lib3rd in the same dir where you find _lib and put your library in there.
    use it in the standard php way,
    publish manually, scriptcase will not automatically include this libray in the deploy.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Thanks Albert!
      I was messing about with the "third" folder I found inside the "prod" folder.... but I think your suggestion would be easier to maintain in the future for updates etc. to the 3rd party library

      Comment


      • #4
        Hrmm... I am trying actually to get a better flow between development and production.... by putting my 3rd party library's folder into the "third" folder it DOES deploy it automatically with the project... which I like. The issue now is how to include it within the project via a path thats the same on both development and production.... this hasn't been so easy.
        I am wondering if there is a way to reference what needs to be included via a variable that represents the prod environment when deployed?

        I see that during setup of the prod environment (When you first upload it you have to setup database access and change password) that you can also specify the path to the files in there...
        I am going to play with this some more and see if there is someway to achieve what I want.

        1. Include 3rd Party Libraries that deploy automatically with the project.
        2. Not have to adjust the require path for development vs production.

        If someone has done all this before... by all means... please chime in here.
        Thanks!

        Comment


        • #5
          I don't know if SC has fixed it, but if you put your libraries in third they will be deleted on each SC upgrade.... So the advantage of automatic upload will have it's drawback....
          Albert Drent
          aducom software netherlands
          scriptcase partner, reseller, support and (turn-key) development
          www.scriptcase.eu / www.scriptcase.nl

          Comment


          • #6
            yourguide,

            I think what you are looking for is:

            require_once($this->Ini->path_third . "/myThirdPartyPackage/CoolPackage.php");

            and Albert is correct. If you do an update of SC in development environment, it deletes directories that it does not know about in prod/third. I keep mine there anyway, it simply means that I have to copy my directory out, do the update, then copy it back. It is worth it so that it gets deployed automatically.

            Dave
            Dave Prue
            Code Whisperer
            Lahar International Corp
            www.lahar.net

            Comment


            • #7
              @aducom/ @daveprue,

              I am following all your instructions to include the KendoUI library in a blank app with this statement:

              require_once($this->Ini->path_third."/Kendo/Autoload.php");

              The library is there physically but instantiation is failing as the following statement

              $datepicker = new /Kendo/UI/DatePicker('datepicker');

              keeps giving me

              "Error
              Undefined variable: datepicker"

              How do you overcome this?

              Comment


              • #8
                Kendo documentation says ... $datepicker = new \Kendo\UI\DatePicker('datepicker');
                Best regards: - Reinhard -

                I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

                Comment


                • #9
                  Originally posted by RHS View Post
                  Kendo documentation says ... $datepicker = new \Kendo\UI\DatePicker('datepicker');
                  Had tried that but exact same error. Besides, I'm working off raw sample code from their site. Same code works outside of SC but I need to be able to do this from a blank SC app. The problem has to do with how SC is dealing with instantiation of classes within nested namespaces/ folders.

                  Comment


                  • #10
                    This works now. My multiline Echo statement had issues, not the instantiation code.

                    Comment

                    Working...
                    X