当前位置: 首页>>代码示例>>C#>>正文


C# ContentAPI.LoadContentByIds方法代码示例

本文整理汇总了C#中ContentAPI.LoadContentByIds方法的典型用法代码示例。如果您正苦于以下问题:C# ContentAPI.LoadContentByIds方法的具体用法?C# ContentAPI.LoadContentByIds怎么用?C# ContentAPI.LoadContentByIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ContentAPI的用法示例。


在下文中一共展示了ContentAPI.LoadContentByIds方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MainView

    protected void MainView()
    {
        if (ContentBlockId > -1)
        {
            ContentAPI capi = new ContentAPI();
            PageBuilder page = (Page as PageBuilder);
            if (ContentBlockId > 0)
            {
                contentBlock.DefaultContentID = ContentBlockId;
                if (page != null && page.CacheInterval > 0)
                {
                    contentBlock.CacheInterval = page.CacheInterval;
                }
                contentBlock.Fill();
                if (contentBlock.EkItem != null)
                {
                    if (contentBlock.EkItem.Title != null)
                        _host.Title = contentBlock.EkItem.Title;
                    if (contentBlock.EkItem.AssetInfo != null && contentBlock.EkItem.AssetInfo.FileExtension != null && contentBlock.EkItem.AssetInfo.FileExtension.ToLower() == "flv")
                    {
                        StringBuilder sbflash = new StringBuilder(); //need object tag here
                        sbflash.Append("<embed id=\"ply\" width=\"" + Width + "\" height=\"" + Height + "\"");
                        sbflash.Append("flashvars=\"file=" + contentBlock.EkItem.AssetInfo.FileName);
                        if (ThumbnailID > 0)
                        {
                            ContentRequest req = new ContentRequest();
                            req.ContentType = EkEnumeration.CMSContentType.AllTypes;
                            req.GetHtml = false;
                            req.Ids = ThumbnailID.ToString();
                            req.MaxNumber = 1;
                            req.RetrieveSummary = false;
                            Ektron.Cms.Common.ContentResult imageresult = capi.LoadContentByIds(ref req, Page);
                            if (imageresult != null && imageresult.Count > 0)
                            {
                                sbflash.Append("&image=" + imageresult.Item[0].AssetInfo.FileName);
                            }
                        }
                        else if (Thumbnail != string.Empty)
                        {
                            sbflash.Append("&image=" + Thumbnail);
                        }
                        sbflash.Append("&autostart=" + AutoStart.ToString().ToLower() + "\"");
                        sbflash.Append("allowscriptaccess=\"always\" allowfullscreen=\"true\" quality=\"high\" bgcolor=\"#CCCCCC\" name=\"ply\" style=\"\"");
                        sbflash.Append("src=\"" + sitePath + "/widgets/Flash/player.swf\" wmode=\"transparent\" type=\"application/x-shockwave-flash\"/>");
                        ltrFlash.Text = sbflash.ToString();
                        Ektron.Cms.API.JS.RegisterJSInclude(this, sitePath + "/widgets/flash/swfobject.js", "widgetFlash.js");
                        contentBlock.Visible = false;
                        ltrFlash.Visible = true;
                    }
                    else
                    {
                        //Ektron.Cms.Controls.ContentBlock contentBlock;
                        if (contentBlock.Text != "")
                        {
                            string html = contentBlock.Text;
                            int startwidth = -1, endwidth = -1, startheight = -1, endheight = -1;
                            startwidth = html.IndexOf("width=\"") + 7;
                            if (startwidth > 0)
                            {
                                endwidth = html.IndexOf("px", startwidth);
                            }
                            startheight = html.IndexOf("height=\"") + 8;
                            if (startheight > 0)
                            {
                                endheight = html.IndexOf("px", startheight);
                            }
                            if (startwidth > 0 && endwidth > startwidth && startheight > 0 && endheight > startheight)
                            {
                                string pixelwidth = html.Substring(startwidth, endwidth - startwidth);
                                string pixelheight = html.Substring(startheight, endheight - startheight);
                                int storedheight = 0;
                                int storedwidth = 0;
                                int.TryParse(Width, out storedwidth);
                                int.TryParse(Height, out storedheight);
                                if (storedheight > 0) html = html.Replace(pixelheight, storedheight.ToString());
                                if (storedwidth > 0) html = html.Replace(pixelwidth, storedwidth.ToString());
                            }
                            ltrFlash.Text = html;

                            contentBlock.Visible = false;
                            ltrFlash.Visible = true;
                        }
                    }
                }
            }
        }
        enableResize = true;
    }
开发者ID:jaytem,项目名称:minGit,代码行数:88,代码来源:Flash.ascx.cs


注:本文中的ContentAPI.LoadContentByIds方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。