本文整理汇总了C#中ContentManager.GetItem方法的典型用法代码示例。如果您正苦于以下问题:C# ContentManager.GetItem方法的具体用法?C# ContentManager.GetItem怎么用?C# ContentManager.GetItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentManager
的用法示例。
在下文中一共展示了ContentManager.GetItem方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Get
public IEnumerable<ContentData> Get()
{
var contentManager = new ContentManager(ApiAccessMode.Admin);
ContentData contentData = contentManager.GetItem(30, returnMetadata: true);
return new ContentData[] { contentData };
}
示例2: Page_Init
/// <summary>
/// Page Init
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Init(object sender, EventArgs e)
{
RightSideContent.ccontentID = mainForm.EkItem.Id.ToString();
RightSideContent.cfolderID = mainForm.EkItem.FolderId.ToString();
uxPageTitle.pgTitle = mainForm.EkItem.Title.ToString();
uxBreadcrumb.contentID = mainForm.EkItem.Id.ToString();
uxPageTitle.pageId = mainForm.EkItem.Id.ToString();
uxPageTitle.ResourceTypeId = "2";
formID = long.Parse(Request.QueryString["ekfrm"].ToString());
contactForm.formID = formID.ToString();
TopDescription = "";
switch (formID)
{
case 112:
uploadFile.Visible = true;
break;
}
ContentManager contentManager = new ContentManager();
ContentData cData = new ContentData();
Boolean returnMetadata = true;
string result = string.Empty;
cData = contentManager.GetItem(formID, returnMetadata);
foreach (ContentMetaData cmd in cData.MetaData)
{
if (cmd.Name == "Forms Description")
{
getUpperText(cmd.Text);
}
}
}
示例3: SetContentParameters
/// <summary>
/// Sets the ContentId and Content fields based on id or page id as specified in the query string
/// </summary>
private void SetContentParameters()
{
long parsedContentId = 0;
if (!string.IsNullOrEmpty(Request.QueryString["id"]))
{
long.TryParse(Request.QueryString["id"], out parsedContentId);
}
else if (!string.IsNullOrEmpty(Request.QueryString["pageid"]))
{
long.TryParse(Request.QueryString["pageid"], out parsedContentId);
}
if (parsedContentId > 0)
{
this.ContentId = parsedContentId;
ContentManager contentManager = new ContentManager();
this.Content = contentManager.GetItem(this.ContentId, false);
}
}
示例4: getUpperText
private void getUpperText(string contentIDd)
{
try
{
if (long.Parse(contentIDd) > 0)
{
ContentManager contentManager = new ContentManager();
ContentData cData = new ContentData();
Boolean returnMetadata = true;
string result = string.Empty;
cData = contentManager.GetItem(long.Parse(contentIDd), returnMetadata);
TopDescription = cData.Html;
}
}
catch { }
}
示例5: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (ContentId != 0)
{
ContentManager contentManager = new ContentManager();
ContentData registerIntro = contentManager.GetItem(ContentId, false);
if (registerIntro != null)
{
litTitle.Text = registerIntro.Title;
litContent.Text = registerIntro.Html;
}
}
}
}
示例6: Page_Init
/// <summary>
/// Page Init
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Init(object sender, EventArgs e)
{
RightSideContent.ccontentID = mainForm.EkItem.Id.ToString();
RightSideContent.cfolderID = mainForm.EkItem.FolderId.ToString();
uxPageTitle.pgTitle = mainForm.EkItem.Title.ToString();
uxBreadcrumb.contentID = mainForm.EkItem.Id.ToString();
uxPageTitle.pageId = mainForm.EkItem.Id.ToString();
uxPageTitle.ResourceTypeId = "2";
try
{
formID = long.Parse(Request.QueryString["formID"].ToString());
}
catch
{
formID = 113;
mainForm.DefaultFormID = 113;
mainForm.Fill();
}
if (!IsPostBack)
{
contactForm.formID = formID.ToString();
TopDescription = "";
switch (formID)
{
case 112:
uploadFile.Visible = true;
break;
}
ContentManager contentManager = new ContentManager();
ContentData cData = new ContentData();
Boolean returnMetadata = true;
string result = string.Empty;
cData = contentManager.GetItem(formID, returnMetadata);
foreach (ContentMetaData cmd in cData.MetaData)
{
if (cmd.Name == "Forms Description")
{
getUpperText(cmd.Text);
}
}
selectOutput = "<option value=''>- Select a subject -</option>";
Dictionary<long, string> contenIdTitles = commonfunctions.getCollectionContentIds(24);
foreach (var a in contenIdTitles)
{
//ListItem li = new ListItem();
//li.Text = a.Value;
//li.Value = "option" + i.ToString();
//contactSelect.Items.Add(li);
//dt.Rows.Add(a.Key);
// Response.Write(a.Key);
if (a.Key == formID)
{
selectOutput += "<option selected value='" + a.Key + "'>" + a.Value + "</option>";
}
else
{
selectOutput += "<option value='" + a.Key + "'>" + a.Value + "</option>";
}
//adding forms
// i++;
}
}
}
示例7: getSideWidget
public void getSideWidget(long MaincontentID)
{
string resultView = string.Empty;
XmlDocument contentXML = new XmlDocument();
string mySidebar = string.Empty;
ContentManager contentManager = new ContentManager();
ContentData cData = new ContentData();
Boolean returnMetadata = true;
string result = string.Empty;
cData = contentManager.GetItem(MaincontentID, returnMetadata);
foreach (ContentMetaData cmd in cData.MetaData)
{
if (cmd.Name == "Side Widget Content")
{
mySidebar = cmd.Text;
}
}
if (mySidebar == "")
{
getAssignedCollection();
}
else
{
string[] swIds = mySidebar.Split(new string[] { ";" }, StringSplitOptions.None);
foreach (string swId in swIds)
{
sideWidgetContent += getSideWidgetDetails(long.Parse(swId));
}
}
// resultView += getSideWidgetDetails(mySidebar);
// return resultView;
}
示例8: GetNewsSpotLightContent
/// <summary>
/// This method is used to get spot light news content from metadata
/// </summary>
private void GetNewsSpotLightContent(long ResourceSpotlightID)
{
try{
ContentManager contentManager = new ContentManager();
ContentData cData = new ContentData();
Boolean returnMetadata = true;
string result = string.Empty;
string title = cData.Title;
cData = contentManager.GetItem(ResourceSpotlightID, returnMetadata);
string teaser = getSubString(cData.Teaser);
ltrNewsSpotlight.Text = "<p><a title=" + title + " aria-label=" + title + " href=\"" + cData.Quicklink + "\">" + teaser + "</a></p>";
} catch {}
//long homeContentId = ConfigHelper.GetValueLong("HomePageCId");
//var homeContentData = ContentHelper.GetContentById(homeContentId, true);
//if (homeContentData != null && homeContentData.MetaData != null)
//{
// long metaSpotLightId = ConfigHelper.GetValueLong("MetaHomePageNewsSpotLightId");
// var metaHomeNews = homeContentData.MetaData.Where(x => x.Id == metaSpotLightId).FirstOrDefault();
// if (metaHomeNews != null && metaHomeNews.Text != string.Empty)
// {
// long newsSpotLightCId = EktUtility.ParseLong(metaHomeNews.Text);
// var newsSpotLightData = SiteDataManager.GetNewsById(newsSpotLightCId);
// if (newsSpotLightData != null && newsSpotLightData.SmartForm != null)
// {
// if (!string.IsNullOrEmpty(newsSpotLightData.SmartForm.Teaser))
// ltrNewsSpotlight.Text = "<p><a href=\"" + newsSpotLightData.Content.Quicklink + "\">" + newsSpotLightData.SmartForm.Teaser + "</a></p>";
// else
// ltrNewsSpotlight.Text = "<p><a href=\"" + newsSpotLightData.Content.Quicklink + "\">" + newsSpotLightData.SmartForm.Headline + "</a></p>";
// }
// }
//}
}
示例9: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
UserData userToEdit = userManager.GetItem(Ektron.Cms.CommonApi.Current.UserId, true);
if (userToEdit != null && Ektron.Cms.CommonApi.Current.UserId != 0)
{
// Set all of the field values to the current user's details
txtFirstName.Text = userToEdit.FirstName;
txtLastname.Text = userToEdit.LastName;
txtEmail.Text = userToEdit.Email;
txtPhone.Text = userToEdit.CustomProperties["Phone"].Value.ToString();
((DropDownList)ddlCountrylist).SelectedValue = userToEdit.CustomProperties["Country"].Value.ToString();
txtUsername.Text = userToEdit.Username;
txtPassword.Attributes.Add("value", userToEdit.Password);
}
if (ContentId != 0)
{
ContentManager contentManager = new ContentManager();
ContentData registerIntro = contentManager.GetItem(ContentId, false);
if (registerIntro != null)
{
litTitle.Text = registerIntro.Title;
litContent.Text = registerIntro.Html;
}
}
}
}