Pages Facade

Posted by Community Admin on 03-Aug-2018 20:49

Pages Facade

All Replies

Posted by Community Admin on 06-Aug-2010 00:00

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?

Posted by Community Admin on 06-Aug-2010 00:00

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

Posted by Community Admin on 06-Aug-2010 00:00

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.

Posted by Community Admin on 07-Aug-2010 00:00

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

This thread is closed