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

Forums / General Discussions / Pages Facade

Pages Facade

4 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    06 Aug 2010
    Link to this post
    Hey Guys, this

    int count;
     
    App.WorkWith()
        .Pages()
        .Count(out count);

    Returns me 74, so I assume that includes all backend stuff as well seeing as we have like 2 pages, default and the bearsharktapus page

    How do I get just user created pages?
  2. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    06 Aug 2010
    Link to this post
    Hey Steve,

    You're correct that back-end pages are still just pages.  The distinction between front-end pages and back-end pages is made through taxonomy.  In fact, if you poke around in the Configuration Editor, you will see the Guid ID that is associated with the root of the front-end & back-end taxonomies.

    All this being said, I can't steer you any further than this. I tried the following code:

    int c;
    var pages = App.WorkWith()
        .Pages()
        .Where(p => p.RootNode.Name == "HomePageId")
        .Count(out c);
     
    Response.Write(c.ToString());

    This feels like it is close, but I'm getting a "Object reference not set to an instance of an object." error.  I'll keep playing though.  If you discover a solution, I'm anxious to hear it.  Otherwise we'll find out the details from the team.

    P.S.  For anyone else also trying to interact with the Fluent API, the default Web Application project is missing an assembly reference for the Facades.  Add a new reference, go into the "bin" folder and then add references for those assemblies.  Visual Studio should now be able to resolve those Facade references.

    Gabe Sumner
    Telerik | Sitefinity CMS
  3. reAnimated
    reAnimated avatar
    11 posts
    Registered:
    27 Apr 2009
    06 Aug 2010
    Link to this post
    Hi Steve,

    You can also try the one bellow. This lets you work only with back-end or front-end pages:
    int count;
    App.WorkWith()
        .Pages()
        .LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend)
        .Count(out count);

    The bearsharktapus page is actually counted as three pages.
  4. Lino
    Lino avatar
    45 posts
    Registered:
    06 May 2005
    07 Aug 2010
    Link to this post
    The following constant is available as a GUID ID in SF 4 to indicate the FrontEnd Tree of pages
    "SiteInitializer.FrontendRootNodeId"

    Instead of pointing to the Home page ID which is probably not what you want.

    Make sure using Telerik.Sitefinity.Abstractions; is in your using area to get access to it.
    Cheers
    Lino
4 posts, 0 answered