public Dynamic.Page GetDynamicPage(BuildManager manager)
{
Item item = Package.GetByName(Package.PageName);
if (item == null)
{
Log.Error("no page found (is this a component template?)");
return null;
}
Page tcmPage = (Page)Engine.GetObject(item.GetAsSource().GetValue("ID"));
int linkLevels;
if (HasPackageValue(Package, "LinkLevels"))
{
linkLevels = Convert.ToInt32(Package.GetValue("LinkLevels"));
}
else
{
GeneralUtils.TimedLog("no link levels configured, using default level " + this.DefaultLinkLevels);
linkLevels = this.DefaultLinkLevels;
}
bool resolveWidthAndHeight;
if (HasPackageValue(Package, "ResolveWidthAndHeight"))
{
resolveWidthAndHeight = Package.GetValue("ResolveWidthAndHeight").ToLower().Equals("yes");
}
else
{
GeneralUtils.TimedLog("no ResolveWidthAndHeight configured, using default value " + this.DefaultResolveWidthAndHeight);
resolveWidthAndHeight = this.DefaultResolveWidthAndHeight;
}
Log.Debug("found page with title " + tcmPage.Title + " and id " + tcmPage.Id);
Log.Debug("constructing dynamic page, links are followed to level " + linkLevels + ", width and height are " + (resolveWidthAndHeight ? "" : "not ") + "resolved");
return manager.BuildPage(tcmPage, Engine, linkLevels, resolveWidthAndHeight);
}