This file contains 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 p = Html.Sitecore().CurrentRendering.Parameters; | |
bool fullWidth = (p["Full width"] == "1") ? true : false; | |
string widthClass = (fullWidth) ? "fullwidth" : "indented"; |
This file contains 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
ImageField field = context.Fields["Img"]; | |
if (field != null && field.MediaItem != null) | |
{ | |
var ImgItem = new Sitecore.Data.Items.MediaItem(field.MediaItem); | |
var ImgUrl = Sitecore.Resources.Media.MediaManager.GetMediaUrl(ImgItem); | |
var ImgCaption = field.Alt; | |
} |
This file contains 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
// define how many items we want per chunk | |
var itemsPerChunk = 3; | |
// break the list of items into chunks | |
var chunks = items.Select((s, i) => new { Value = s, Index = i }).GroupBy(item => item.Index / itemsPerChunk, item => item.Value); | |
// iterate through each chunk | |
foreach (var chunk in chunks) | |
{ | |
<div class="row"> |
This file contains 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
$('#article-content').find('h1,h2,h3,h4,h5,h6').each(function(i,el) {console.log(i + "\t" + el.tagName + "\t" + $(el).text())}) |
This file contains 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
List<Item> items = (Sitecore.Context.Item.Axes.SelectItems(query) ?? new Item[] { }).ToList(); |
This file contains 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
ids.ForEach(id => { | |
itineraries.Add(Sitecore.Context.Database.GetItem(id)); | |
}); |
This file contains 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
<ul> | |
<asp:Repeater ID="rpFooterDestinations" runat="server"> | |
<ItemTemplate> | |
<li> | |
<a href="<%# Sitecore.Links.LinkManager.GetItemUrl( | |
(Sitecore.Data.Items.Item) Container.DataItem | |
) %>"><%# Eval("DisplayName") %></a> | |
</li> | |
</ItemTemplate> | |
</asp:Repeater> |
This file contains 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
@{ | |
LinkField URL = item.Fields["URL"]; | |
if (URL != null) | |
{ | |
<a href="@URL.Url" target="@URL.Target" title="@URL.Title">@URL.Title ></a> | |
} | |
} |
This file contains 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 market = MarketInfo.Markets.SingleOrDefault(m => m.Code == Visitor.CountryCode); | |
if (market == null) | |
market = Visitor.Market; |
This file contains 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
-- Takes a timestamp (in seconds) and a timezone offset (eg +0730) and returns a timestamp | |
CREATE TEMPORARY FUNCTION applyTZOffsetToUnixTimestamp(ts INT64, tzOffset STRING) | |
RETURNS INT64 AS ( | |
CASE | |
WHEN SUBSTR(tzOffset, 1, 1) = '+' THEN ts + (CAST(SUBSTR(tzOffset, 2, 2) AS INT64) * 60 * 60) + (CAST(SUBSTR(tzOffset, 4, 2) AS INT64) * 60) | |
WHEN SUBSTR(tzOffset, 1, 1) = '-' THEN ts - (CAST(SUBSTR(tzOffset, 2, 2) AS INT64) * 60 * 60) - (CAST(SUBSTR(tzOffset, 4, 2) AS INT64) * 60) | |
ELSE NULL | |
END | |
); |
OlderNewer