I have a sub-application (YetAnotherForum.NET) living in a child directory of my Composite C1 site. In order to maintain a consistent look and feel I want to pull in C1 functions for the navigation elements.
Note: All html mark-up in code below has had pointy brackets replaced with square brackets in order to allow posting here.
I've figured out I can call C1 functions using this syntax:
[f:function ID="Function1" name="Custom.Layout.FooterLinks" runat="server"/]
However, the data behind the function seems to be unavailable. Any ideas what the data issue might be? Perhaps I need the external page to inherit from some form of Composite C1 page?
Here's the function code:
@using Composite.Data;
@using Composite.Data.Types;
@using Composite.Data.ProcessControlled.ProcessControllers.GenericPublishProcessController;
@using CompositeC1Contrib.RazorFunctions;
@inherits CompositeC1WebPage
@functions {
private IEnumerable FooterLinkPages()
{
IEnumerable pages = DataFacade.GetData();
IEnumerable returnPages;
using (DataConnection connection = new DataConnection())
{
returnPages = (from l in connection.Get()
join p in pages on l.Page equals p.Id
where l.PublicationStatus == GenericPublishProcessController.Published
&& p.PublicationStatus == GenericPublishProcessController.Published
orderby l.Position ascending
select p).ToList();
}
return returnPages;
}
}
[ul class="unstyled"]
@foreach (IPage page in FooterLinkPages())
{
[li]@(String.IsNullOrWhiteSpace(page.MenuTitle) ? page.Title : page.MenuTitle)[/a][/li]
}
[/ul]
You need to wrap the data access code in: