This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private DisplayEnum _display = DisplayEnum.TitleAndBorder; | |
| [WebBrowsable(true), Personalizable(PersonalizationScope.Shared)] | |
| public DisplayEnum Display | |
| { | |
| get { return _display; } | |
| set { _display = value; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var image = (ImageFieldValue)SPContext.Current.File.Item["ImageFieldName"]; | |
| if (image != null) | |
| { | |
| string imageUrl = image.ImageUrl; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var isCheckedOut = false; | |
| if (typeof (PageState) != "undefined" && PageState) { | |
| isCheckedOut = PageState.ItemIsCheckedOutToCurrentUser == "1"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="myDiv" ng-controller="MyCtrl"> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var menuItems = new List<MenuItem>(); | |
| // add items | |
| menuItems.sort(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <configuration xmlns:patch="http://www.sitecore.net/xmlconfig/"> | |
| <sitecore> | |
| <contentSearch> | |
| <configuration type="Sitecore.ContentSearch.ContentSearchConfiguration, Sitecore.ContentSearch"> | |
| <indexes hint="list:AddIndex"> | |
| <!-- Change this to Sitecore.ContentSearch.LuceneProvider.SwitchOnRebuildLuceneIndex, Sitecore.ContentSearch.LuceneProvider if you would like indexes to be | |
| built in a temporary directory i.e. while rebuilding is happening, your old indexes work like normal until the rebuild is finished. --> | |
| <index id="content_index" type="Sitecore.ContentSearch.LuceneProvider.LuceneIndex, Sitecore.ContentSearch.LuceneProvider"> | |
| <param desc="name">$(id)</param> | |
| <param desc="folder">$(id)</param> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyResultItem : SearchResultItem | |
| { | |
| [IndexField("Heading")] | |
| public string PageHeading { get; set; } | |
| [IndexField("Content")] | |
| public string PageContent { get; set; } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var searchResults = new List<SearchResult>(); | |
| string searchTerm = Request.QueryString["term"]; | |
| var index = ContentSearchManager.GetIndex("content_index"); | |
| using (var context = index.CreateSearchContext()) | |
| { | |
| var results = context.GetQueryable<MyResultItem>().Where(resultItem => resultItem.PageHeading.Like(searchTerm) || resultItem.PageContent.Contains(searchTerm)).GetResults(); | |
| foreach (var result in results) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// Get the URL for a given sitecore linkfield | |
| /// </summary> | |
| /// <param name="lf">sitecore linkfield</param> | |
| /// <returns>web URL</returns> | |
| public static string GetLinkFieldURL(LinkField lf) | |
| { | |
| switch (lf.LinkType.ToLower()) | |
| { | |
| case "internal": |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// <summary> | |
| /// get image url from sitecore imagefield | |
| /// </summary> | |
| /// <param name="field">imagefield</param> | |
| /// <returns>image url</returns> | |
| public static string GetImageURL(ImageField field) | |
| { | |
| string imageURL = string.Empty; | |
| if (field != null && field.MediaItem != null) | |
| { |