More in this section

Forums / Developing with Sitefinity / XML Gallery for flash

XML Gallery for flash

4 posts, 0 answered
  1. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    03 Dec 2009
    Link to this post
    Hi Guys,

    I need to be able to output the content of a gallery in XML format so that I can read it into a Flash file for a gallery.

    Can you please let me know if this is possible and what attributes are passed through in the XML?

    Ideally, I need the asset name (image name) and possibly a description for the asset to come through in the XML.

    Thanks,
    James
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Dec 2009
    Link to this post
    Hello James,

    Below is a sample code that illustrates how to get required objects

    // GET CONTENT OBJECTS
         LibraryManager lManager = new LibraryManager("Libraries");
         ILibrary lib = lManager.GetLibrary("MyImages");
         foreach (IContent cnt in lib.GetItems())
         {
             string name = (string)cnt.GetMetaData("Name");
             string description = (string)cnt.GetMetaData("Description");
         }
          ....
                 .....
                          ....
     
        //WRITE TO FILE
        XmlTextWriter writer = new
        XmlTextWriter(Server.MapPath("video.xml"), Encoding.UTF8);
         writer.WriteStartDocument();
         writer.WriteStartElement("itemInfo");
         writer.WriteStartElement("contentData");
         if (Request.UrlReferrer == null)
             writer.WriteElementString("name", "none");
         else
             writer.WriteElementString("name",
                              Request.UrlReferrer.PathAndQuery);
         writer.WriteElementString("description", Request.UserAgent);
         writer.WriteElementString("description",
                          String.Join(", ", Request.UserLanguages));
            ....
               // END WRITING
              ....
         writer.WriteEndDocument();
         writer.Close();


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. James@Nw
    James@Nw avatar
    265 posts
    Registered:
    05 May 2009
    03 Dec 2009
    Link to this post
    Hi Ivan,

    Thanks for the quick response! Excuse my lack of knowledge when it comes to ASP.net but could you show me how and where I would need to add this please?

    Thanks,
    James
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    04 Dec 2009
    Link to this post
    Hello James,

    You could create a user control add add the logic on button.click event. After you get the items' name and description you can call a helper method that will write to your xml.

    You can take a look at the following articles
    Content Items Overview
    XmlTextWriter Class

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
4 posts, 0 answered