I recently build a social media share function for Facebook, Twitter, LinkedIn and Google+ in a Sitecore CMS solution. There is also an add to favorites in Internet Explorer and Bookmark for Mozilla Firefox. The icons slides out when clicking the share-icon using jQuery toggle. The icons are all stored in one image using CSS sprite technique.
Behövde hämta ut pipe-separerade värden från ett fält i Sitecore och skrev ihop den här funktionen för att spara dem till en array:
public string[] getPipedSeparatedFieldValues(string fieldName) { var fieldValues = CurrentItem.Fields[fieldName].Value; if (!string.IsNullOrEmpty(fieldValues)) { string[] fieldValue = fieldValues.Split('|'); string[] fieldArray = new string[fieldValue.Count()]; int arrayIndex = 0; foreach (string value in fieldValue) { fieldArray[arrayIndex++] = value; } return fieldArray; } return null; }
Senaste kommentarer