1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / One Handler xml to expose Doc & Image libraries to searching

One Handler xml to expose Doc & Image libraries to searching

4 posts, 0 answered
  1. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    23 Jun 2008
    Link to this post

    Hi,

    Could you help-us to create one handler to expose the content of Module libraries (title, metafields, and files) as xml to external tools like google searching and in general all contents of Generic Modules. I'm search to connecting my sf.solution with flash.
    Thanks for your help,

    Regards

     

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    25 Jun 2008
    Link to this post
    Hello Pierre,

    You should have no problems to expose the Generic Content with the available APIs, in any format you would like. I don't believe that Google will index URLs which represent Images or Documents, because when such an Item is crawled, GoogleBot is trying to make associations with it and the page content. In this case, we don't have page content, but only item, so most probably, this item won't be crawled at all.

    The association with external applications (like the Flash player) is reasonable, but as I already mentioned, there shouldn't be any problems to generate such XMLs using our APIs with Content Managers Classes and the XmlWriter class for example.
    We encourage you to try developing this tool or service, and we will assist you in case you meet some difficulty or problem. Note that we do not provide entire custom solutions and it is the developer’s responsibility to define the schema/specification of the main project relations and process the implementation.

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Pierre
    Pierre avatar
    433 posts
    Registered:
    16 Feb 2006
    25 Jun 2008
    Link to this post

    Hi Georgi,

    I have developed one learning solution with flash. I need to expose my doc and image contents and some News contents with Xml as handler.
    I post my initial handler. Could you help me to found sample items like metafields and the docs and image to expose to my flash solution.
    I need found Metafields from Telerik.News and Docs and Image from this Module with Metafields and One Image and One Document content inside.

    Many thanks for your help.

    <%@ WebHandler Language="C#" Class="videosList" %> 
     
    using System;  
    using System.Data;  
    using System.Configuration;  
    using System.Collections.Generic;  
    using System.Web;  
    using System.Xml;  
    using System.Text;  
     
       
        public class videosList : IHttpHandler  
        {  
            public videosList()  
            {  
            }  
              
            public void ProcessRequest(HttpContext context)  
            {  
                XmlTextWriter writer = new XmlTextWriter(context.Response.OutputStream, Encoding.UTF8);  
                context.Response.ContentType = "text/xml";  
     
                writer.Formatting = Formatting.Indented;  
                writer.WriteStartDocument();  
                writer.WriteStartElement("course");  
                //start  
                    writer.WriteAttributeString("Code","DEMO");//1  
                    writer.WriteAttributeString("name","Demo Classes");//2  
                    writer.WriteAttributeString("CourseID","-1");//3  
     
                // DATABASE LINK CONNECTION  
                  
     
                // fake loop  
                for (int i = 0; i < 10; i++)  
                {  
                    //<unit> 
                    // HERE SOME TELERIK. NEWS ITEMS LIKE TITLE, AUTHOR,..  
     
            writer.WriteStartElement("unit");  
                    writer.WriteAttributeString("number", "1");//1  
                      
                    // required  
                    writer.WriteStartElement("video");  
     
                    // start:optional  
                    // <video> 
                    // HERE SOME ITEMS FROM DOCS AND IMAGES AS TEXT METAFIEDLS  
     
            writer.WriteAttributeString("aliasCourseCode", "BC101");  
                    writer.WriteAttributeString("aliasUnitNumber", "1");  
                      
            // HERE SOME LINK TO RESOURCES LIKE IMAGES, AND DOCS  
            // IN MY CASE IS XML DOCS, VIDEO, SOUNDS  
          
            writer.WriteAttributeString("active", "true");  
                     
                    // end:optional  
     
                    writer.WriteEndElement(); // video  
                    writer.WriteEndElement(); //unit  
                }  
     
                writer.WriteEndElement(); //course   
                writer.WriteEndDocument();  
                writer.Close();  
            }  
            public bool IsReusable  
            {  
                get { return false; }  
            }  
        }  
     

     

     

     

  4. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    30 Jun 2008
    Link to this post
    Hi Pierre,

    Here's useful code with comments. These are the basics, you just need it in your code:

    using Telerik.News; 
    using Telerik.Cms.Engine; 
    using Telerik.Libraries; 
    ... 
    ... 
            string Author, Content; 
            // prepare the News Manager, so you could work with News Items 
            NewsManager NewsMan = new NewsManager(); 
            // Get All items in a list 
            IList newsList = NewsMan.Content.GetContent(); 
            // Get the first element. You may also iterate through all elements 
            IContent FirstContent = (IContent)newsList[0]; 
            // Get the actual content and some Metafield.. 
            Content = FirstContent.Content; 
            Author = FirstContent.GetMetaData("Author"); 
            //add to page(via control) or xml... 
            Literal lnewsItem = new Literal(); 
            lnewsItem = Author + ":" + Content; 
            this.Controls.Add(lnewsItem); 
     
            //the same for libraries..Get an item from library
            //named Pics

            LibraryManager LibMan = new LibraryManager(); 
            ILibrary MyLib = LibMan.GetLibrary("Pics"); 
            IList MyLibItems = MyLib.GetItems(); 
     
            IContent one = (IContent)MyLibItems[0]; 
            //do something with item one, from library Pics. 

    The example is for News Items and Library Items, but it is the same for every other Generic Content Based module, only the Managers are different.

    I hope this is helpful.


    Kind regards,
    Georgi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
4 posts, 0 answered