[campsite-support] Re: Import External Data
  • Hi Jason,

    Thanks for the question, as well as for your interest in Campsite. The new
    Campsite 2.5 has a PHP API that will probably save you a lot of grief. I'm
    forwarding your message to the Campsite support mailing list, which you
    can sign up for at this address:

    http://sympa.mdlf.org/wws/subscribe/campsite-support

    Good luck with your import. I'm looking forward to hearing what the
    Campsite developers have to say.

    Best regards,

    douglas

    =============================================
    Media Development Loan Fund
    =============================================
    Douglas Arellanes
    Head of Research and Development
    Center for Advanced Media--Prague (CAMP)
    Na vinicnich horach 24a/1834, 160 00 Prague 6
    Czech Republic
    Tel: + 420 2 3333 5356, Fax: +420 2 2431 5419
    Mobile: +420 724 073 364
    http://www.mdlf-camp.net
    http://www.campware.org
    =============================================
    http://www.mdlf.org
    =============================================




    "Jason Gerard"
    03/09/2006 08:36 PM


    To:
    cc:
    Subject: Import External Data


    Hi there,

    I'm currently building content for a publication. The magazine I'm doing
    this for has older, archived data - a lot - and wants to put it into the
    Campsite system. The problem is the data is in an organized format (such
    as delimited list or spreadsheet file). Is there anyway to import article
    data into Campsite instead of manualling typing in every part of the
    article? Any method that would fully or partially streamline the process
    would be helpful. The reason I am asking is there is a huge volume of
    data to input.

    Thanks,
    Jason Gerard
    Chief Systems Architect, Creative Motion
    telephone: (416) 944 - 9063 | website: http://www.creativemotion.ca | email: jason@creativemotion.ca
    * Confidentiality Notice *
    This message, including any attachments, is confidential and/or
    privileged, and the property of Creative Motion. It may not be reproduced
    or released without our consent. If you received this email by error,
    please notify us immediately and permanently delete the original
    transmission from your system, including attachments, without making a
    copy.
  • 1 Comment sorted by
  • Hi Jason -
    You can write a PHP script to import all the data automatically.

    Before you create your script, make the appropriate article types that
    will contain your data. (Use the admin interface to do this:
    Configuration->Article Types)

    Then write your script. The first part of your script would read in
    your data and parse it into its various fields. The second part of your
    script would insert them into Campsite.

    Take a look at this page for an example of how to use the Campsite API:
    http://code.campware.org/projects/campsite/wiki/ArticleApiExample

    The full documentation for the entire Campsite API is here:
    http://code.campware.org/api/campsite-2.5/

    And here is a specific example of something you might do:

    -------------------------------------------------------------------------
    // Assume each $record has the following data: "title", "intro", "body"
    // and that you've created an article type with those same fields
    // called "jasons_article_type".

    $articleType = "jasons_article_type";
    $languageId = 1; /* English */

    foreach ($records as $record) {
    // Create the article
    $article =& new Article($languageId);
    $article->create($articleType, $record["title"]);

    // update the data
    $articleData =& $article->getArticleTypeObject();
    $articleData->setProperty("intro", $record["intro"]);
    $articleData->setProperty("body", $record["body"]);
    }
    -------------------------------------------------------------------------

    I dont know how much programming experience you have, so let me know if
    you need any help.

    - Paul


    Douglas.Arellanes@mdlf.org wrote:
    >
    > Hi Jason,
    >
    > Thanks for the question, as well as for your interest in Campsite. The
    > new Campsite 2.5 has a PHP API that will probably save you a lot of
    > grief. I'm forwarding your message to the Campsite support mailing list,
    > which you can sign up for at this address:
    >
    > http://sympa.mdlf.org/wws/subscribe/campsite-support
    >
    > Good luck with your import. I'm looking forward to hearing what the
    > Campsite developers have to say.
    >
    > Best regards,
    >
    > douglas
    >
    > =============================================
    > Media Development Loan Fund
    > =============================================
    > Douglas Arellanes
    > Head of Research and Development
    > Center for Advanced Media--Prague (CAMP)
    > Na vinicnich horach 24a/1834, 160 00 Prague 6
    > Czech Republic
    > Tel: + 420 2 3333 5356, Fax: +420 2 2431 5419
    > Mobile: +420 724 073 364
    > http://www.mdlf-camp.net
    > http://www.campware.org
    > =============================================
    > http://www.mdlf.org
    > =============================================
    >
    >
    > *"Jason Gerard" *
    >
    > 03/09/2006 08:36 PM
    >
    >
    > To:
    > cc:
    > Subject: Import External Data
    >
    >
    >
    >
    > Hi there,
    >
    > I'm currently building content for a publication. The magazine I'm
    > doing this for has older, archived data - a lot - and wants to put it
    > into the Campsite system. The problem is the data is in an organized
    > format (such as delimited list or spreadsheet file). Is there anyway to
    > import article data into Campsite instead of manualling typing in every
    > part of the article? Any method that would fully or partially
    > streamline the process would be helpful. The reason I am asking is
    > there is a huge volume of data to input.
    >
    > Thanks,
    >
    > *Jason Gerard*/
    > Chief Systems Architect/, Creative Motion
    > telephone: (416) 944 - 9063 | website: _http://www.creativemotion.ca_
    > | email: _jason@creativemotion.ca_
    >
    >
    > * Confidentiality Notice *
    > This message, including any attachments, is confidential and/or
    > privileged, and the property of Creative Motion. It may not be
    > reproduced or released without our consent. If you received this email
    > by error, please notify us immediately and permanently delete the
    > original transmission from your system, including attachments, without
    > making a copy.
    >