November Happy Hour will be moved to Thursday December 5th.

How can I get HTML markup from ContentArea

Vote:
 

Hi,

I have a feed that I would like to pass the HTML markup from a specific contentArea of a News article page. At the moment I get the Pagedata of all the article pages via a webservice but I need to get the markup from an ExtensionContentArea by Id per article page.

Is this possible and if so how is it done?

Thanks

Jon

#151509
Jul 26, 2016 14:19
Vote:
 

Is this at all possible?

#151527
Jul 27, 2016 9:20
Vote:
 

You can read more about custom rendering blocks from content area here 

http://joelabrahamsson.com/custom-rendering-of-content-areas/

It's possible but normally cheaper to take gui developer in the ear to make html match the standard with containing tags etc / use multiple content areas...

#151531
Jul 27, 2016 9:33
Vote:
 

Hi,

Im sorry but Im not sure what you mean.

Basically I am using a search such as:

 var pages = DataFactory.Instance.FindPagesWithCriteria(PageReference.StartPage, criterias, lang.LanguageBranch);

and I need to loop the pages to get the content from this control:

<Extension:ExtensionContentArea ID="ContentMain" Description="Main Content Area" runat="server"></Extension:ExtensionContentArea>

Is this possible?

Thanks

Jon

#151532
Edited, Jul 27, 2016 9:45
Vote:
 

Also, the language branch doesnt seem to bring back the correct URLs to the page - they are still in the default english lanuage.

#151533
Jul 27, 2016 9:46
Vote:
 

Hi,

I have found this link:

http://marekblotny.blogspot.co.uk/2009/06/episerver-composer-how-to-load-content.html

BUT - on line 6 it is using Page - which im not sure how I can use this - as I am running this feed as an RSS feed in an ashx using FindPagesWithCriteria

Can anyone help?

Jon

#151535
Jul 27, 2016 10:31
Vote:
 

Sorry. Noticed the version too late :) ignore my previous comment...

#151544
Jul 27, 2016 22:43
Vote:
 

For everyone who wants to know this is how I did it:

 public string GetContentFromCompaoserBlock(PageData child)
        {
            string output = "";
            var structure = PageDataManager.LoadPageStruct(child.PageLink);
            var contentArea = structure.GetContentAreaById("ContentMain");

            try
            {
                ExtensionPageData page = ExtensionPageData.Load(child.PageLink);
                if (page != null && page.AreaCount > 0)
                {
                    List<ContentFunctionData> functions = page.GetAllContentFunctions(true);
                    if (functions.Count > 0)
                    {
                        foreach (var item in functions)
                        {
                            ContentFunctionReference cfr = new ContentFunctionReference(item.FunctionID, item.WorkID);
                            PageData pdCurrent = EPiServer.DataFactory.Instance.GetPage(cfr);
                            if (pdCurrent.PageTypeName == "[ExtensionSys] Text")
                            {
                                output += pdCurrent.Property["Content"].ToString();
                            }
                        }
                    }
                    else
                    {
                        output = "NOTHING";
                    }
                }
            }
            catch (Exception ex)
            {

            }



            return output; 

}
#151555
Jul 28, 2016 14:08
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.