Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Galina 44 posts 258 karma points
    Oct 22, 2014 @ 08:32
    Galina
    0

    Is field recursive?

    Hello.

    I have an api controller and need to know is field like this

    <umbraco:Item field="innerfielddetail" recursive="true" runat="server" />
    

    is recursive or no. 

    Now I'm trying to parse template using regex.

    Is it possible to know it without regex? Is there any methods in Umbraco?

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Oct 22, 2014 @ 08:55
    Jeavon Leopold
    0

    In an API controller you should be using UmbracoHelper and the GetPropertyValue(propertyAlias, true) the second parameter "true" makes it recursive.

    Perhaps you could post some of your code?

  • Galina 44 posts 258 karma points
    Oct 22, 2014 @ 08:58
    Galina
    0

    Hello, Jeavon.

    I don't know is field recirsive or not. I need to know it. How can I define? My regex isn't good, it doesn't work in all cases

    template = (new Regex("<umbraco:Item field=\"(?<ID>\\S+)\".*?(recursive=\"(?<recursive>\\S+)\")??.*?/>", RegexOptions.IgnoreCase|RegexOptions.Singleline))
                    .Replace(template,m =>PageFlowManager.ReplaceItemFieldWithPropertyValue(m,publishedContent));

     

    template - is thу whole page template. 

  • Jeavon Leopold 3072 posts 13628 karma points MVP 10x admin c-trib
    Oct 22, 2014 @ 09:01
    Jeavon Leopold
    0

    Can you explain why you are parsing the template at all?

  • Galina 44 posts 258 karma points
    Oct 22, 2014 @ 09:17
    Galina
    0

    We use Umbraco as external service for site. And I need to return code from like this

    <%@ Master Language="C#" MasterPageFile="~/masterpages/MasterPage.master" AutoEventWireup="true" %> <asp:content ContentPlaceHolderId="head" runat="server"> </asp:content> <asp:content ContentPlaceHolderId="PageHeader" runat="server"> </asp:content> <asp:content ContentPlaceHolderId="phCenter" runat="server"> <p>InnerFieldContent</p> </asp:content> <asp:content ContentPlaceHolderId="PageLeft" runat="server">  </asp:content> <asp:content ContentPlaceHolderId="PageFooter" runat="server"> </asp:content> <asp:content ContentPlaceHolderId="phRight" runat="server"> </asp:content>
    </string>

    but the whole template is

    <%@ Master Language="C#" MasterPageFile="~/masterpages/MasterPage.master" AutoEventWireup="true" %>
    <asp:content ContentPlaceHolderId="head" runat="server">
        <umbraco:Item field="HeadScriptTitle" recursive="true"  runat="server" />
    </asp:content>
    <asp:content ContentPlaceHolderId="PageHeader" runat="server">    
        <umbraco:Item field="HeadOfPage"  recursive="true" runat="server" />
    </asp:content>
    <asp:content ContentPlaceHolderId="phCenter" runat="server">  
        <umbraco:Item field="PageCenterField" runat="server" />
    <umbraco:Item field="innerfielddetail" recursive="true" runat="server" />     
    </asp:content>    
    <asp:content ContentPlaceHolderId="PageLeft" runat="server">  
        <umbraco:Item field="PageLeft" recursive="true"  runat="server" />
        <umbraco:Macro menuIdArray="menuIDs" Alias="MenuRender"  runat="server"></umbraco:Macro>    
    </asp:content>
    <asp:content ContentPlaceHolderId="PageFooter" runat="server">    
        <umbraco:Item field="PageFooter" recursive="true"  runat="server" />
    </asp:content>
    <asp:content ContentPlaceHolderId="phRight" runat="server">   
        <umbraco:Item field="PageRight" recursive="true"  runat="server" />
    </asp:content>

    I need to replace umbraco:Item with macro (I use the same path in the site) and html-tags. Without umbraco:Item. But I can't write correct regex for "recursive"

     

Please Sign in or register to post replies

Write your reply to:

Draft