Exemplo n.º 1
0
        public override string Publish2(CmsPage page)
        {
            string  html = "";
            CmsMenu menu = GetMenu();

            if (menu == null)
            {
                this.Content = "Kies eerst een menu";
                html         = base.Publish2(page);
            }
            else
            {
                html = base.Publish2(page);
                string menuItemsHtml    = "";
                string menuTemplate     = base.GetSubTemplate("{Menu}");
                string menuItemTemplate = base.GetSubTemplate("{MenuItems}");
                foreach (CmsMenuItem mainItem in menu.GetParentMenuItems())
                {
                    string menuItemHtml = menuItemTemplate;
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.Name}", mainItem.Name);
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.Title}", mainItem.Title);
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.Url}", mainItem.Url);
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.Target}", mainItem.Target);
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.CssClass}", mainItem.CssClass);
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.Link}", createHyperLink(mainItem));
                    menuItemHtml = menuItemHtml.Replace("{/MenuItem.Link}", "</a>");
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.ImageUrl}", mainItem.ImageUrl);
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.ImageHoverUrl}", mainItem.ImageHoverUrl);
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.ImageActiveUrl}", mainItem.ImageActiveUrl);
                    string subItemsHtml = GetSubItemsHtml(menuTemplate, menuItemTemplate, mainItem);
                    menuItemHtml = menuItemHtml.Replace("{MenuItem.ChildItems}", subItemsHtml);

                    menuItemsHtml += menuItemHtml;
                }
                html = html.Replace("<!--{MenuItems}-->" + menuItemTemplate + "<!--{/MenuItems}-->", menuItemsHtml);
                //html = html.Replace("{Menu}" + menuTemplate + "{/Menu}", menuItemsHtml);
                string cssClass       = "bitMenu";
                int    animationspeed = getSetting <int>("AnimationSpeed");
                string menuType       = "";
                if (menu.Type == MenuTypeEnum.Accordion)
                {
                    cssClass = "bitAccordionMenu";
                }
                if (menu.Type == MenuTypeEnum.HorizontalDropDown)
                {
                    menuType = "dropdownHorizontal";
                }
                if (menu.Type == MenuTypeEnum.VerticalDropDown)
                {
                    menuType = "dropdownVertical";
                }

                html = html.Replace("<!--{Menu}-->", "<div class='" + cssClass + "' data-menu-type='" + menuType + "' data-menu-animationspeed='" + animationspeed + "'>");
                html = html.Replace("<!--{/Menu}-->", "</div>");
                html = html.Replace("{Menu}", "<div class='bitMenu'>");
                html = html.Replace("{/Menu}", "</div>");
            }
            return(html);
        }
Exemplo n.º 2
0
        public override string Publish2(CmsPage page)
        {
            string  html = "";
            CmsMenu menu = GetMenu();

            if (menu == null)
            {
                this.Content = "Kies eerst een menu";
                html         = base.Publish2(page);
            }
            else
            {
                string js  = getSetting <string>("MenuJs");
                string css = getSetting <string>("MenuCss");
                if (js != null && js != String.Empty)
                {
                    this.Content = "<script type='text/javascript'>" + js + "</script>\r\n" + this.Content;
                }
                if (css != null && css != String.Empty)
                {
                    this.Content = "<style>" + css + "</style>\r\n" + this.Content;
                }
                html = base.Publish2(page);
                string mainItemsHtml    = "";
                string mainItemTemplate = base.GetSubTemplate("{MainMenuItems}");
                string subMenuTemplate  = base.GetSubTemplate("{SubMenu}");
                string subItemTemplate  = base.GetSubTemplate("{SubMenuItems}");
                foreach (CmsMenuItem mainItem in menu.GetParentMenuItems())
                {
                    string mainItemHtml = mainItemTemplate;
                    mainItemHtml = mainItemHtml.Replace("{RootItem.Name}", mainItem.Name);
                    mainItemHtml = mainItemHtml.Replace("{RootItem.Title}", mainItem.Title);
                    mainItemHtml = mainItemHtml.Replace("{RootItem.Url}", mainItem.Url);
                    mainItemHtml = mainItemHtml.Replace("{RootItem.Target}", mainItem.Target);
                    mainItemHtml = mainItemHtml.Replace("{RootItem.Link}", createHyperLink(mainItem));
                    mainItemHtml = mainItemHtml.Replace("{/RootItem.Link}", "</a>");
                    mainItemHtml = mainItemHtml.Replace("{RootItem.ImageUrl}", mainItem.ImageUrl);
                    mainItemHtml = mainItemHtml.Replace("{RootItem.ImageHoverUrl}", mainItem.ImageHoverUrl);
                    mainItemHtml = mainItemHtml.Replace("{RootItem.ImageActiveUrl}", mainItem.ImageActiveUrl);
                    string subItemsHtml = GetSubItemsHtml(subMenuTemplate, subItemTemplate, mainItem);
                    mainItemHtml = mainItemHtml.Replace("<!--{SubMenu}-->" + subMenuTemplate + "<!--{/SubMenu}-->", subItemsHtml);
                    mainItemHtml = mainItemHtml.Replace("{SubMenu}" + subMenuTemplate + "{/SubMenu}", subItemsHtml);

                    mainItemsHtml += mainItemHtml;
                }
                html = html.Replace("<!--{MainMenuItems}-->" + mainItemTemplate + "<!--{/MainMenuItems}-->", mainItemsHtml);
                html = html.Replace("{MainMenuItems}" + mainItemTemplate + "{/MainMenuItems}", mainItemsHtml);
            }
            return(html);
        }