Hao's experience
Needed:
webzone:
<cms:CMSWebPartZone ZoneID="zoneContent" runat="server" />
genarate class row for every 3 item ternary operator
<%# (((DataItemIndex % 3) == 0)&& (DataItemIndex>=3))?"</div><div class=\"row\">":"" %>
get file url
<%# IfEmpty(Eval("NewsTeaserThumb"), "", .GetFileUrl("NewsTeaserThumb")) %>
solve macro from ASCX
<%# CMS.MacroEngine.MacroResolver.Resolve("{#TO_GetResourcesHeader#}") %>
getdata from node
TreeNode node = TreeHelper.SelectSingleNode(NodeID);
node.GetValue(VideoLink);
load more button
<div class="col-sm-12"><input id="loadmore" class="btn btn-primary btn-block btn-lg" type="button" value="LOAD MORE"></div>
get link
<a href="<%# GetDocumentUrl() %>">
<a href="{%Transformation.GetDocumentUrl()#%}>
<a href="<%# GetDocumentUrl(Eval("DocumentID")) %>">
get image
<div class="media bg-cover" style="background-image:url('<%# IfEmpty(Eval("ArticleTeaserImage"), "", GetFileUrl("ArticleTeaserImage")) %>')">
get date
<p class="date"><%# GetDateTime("DocumentCreatedWhen", "dd MMMM yyyy") %></p>
macro > {% FormatDateTime(CurrentDocument.DocumentCreatedWhen, "dd MMMM yyyy") #%}
compare if id is curent id
get query in Macro(cycle tour)
{% if(Trim(QueryString["country1"]) != "") {"(TourCountry = " + QueryString.country1 + ") AND (TourStatus > 0) AND (TourStatusByOperator =1) AND (TourNote <>'') AND (TourSpecialDealExpiry >= CAST(CURRENT_TIMESTAMP AS DATE))"} else {"TourStatus > 0 AND TourStatusByOperator =1 AND TourNote <>'' AND TourSpecialDealExpiry >= CAST(CURRENT_TIMESTAMP AS DATE)"} #%}
limit number of words
<%# LimitLength(Eval("TourDescription"), 180, " ...", true) %>
<%# LimitLength(Eval("BlogPostSummary"), 180, " ...", true) %>
compare date
<div class="calendar <%# DateTime.Compare((DateTime)Eval("EventOpenFrom"), DateTime.Today) > 0 ? "" : "inactive" %> ">
get custom string i
<%#CMS.DataEngine.SettingsKeyInfoProvider.GetStringValue(CMS.SiteProvider.SiteContext.CurrentSiteName + ".key")%>
{%Settings.CustomSettings.General.UseDefault#%}
DocumentMenuItemHideInNavigation='false'
check if home or not
{% CurrentDocument.NodeAliasPath!="/Home"#%}
{% CurrentDocument.NodeAliasPath.contains("Jobs-Board") || CurrentDocument.DocumentName=="Contact" || CurrentDocument.NodeAliasPath.contains("News")#%}
in ascx
notation for home
<%= CurrentDocument.NodeAliasPath.Contains("Home")?" no-submenu":"" %>=
order
NodeLevel, NodeOrder, NodeName
{% DocumentContext.CurrentDocument.DocumentName=="News" ? "PostIsEvent=0" : DocumentContext.CurrentDocument.DocumentName=="Events"? "PostIsEvent=1":"" #%}
<%#IfEmpty(Eval("DocumentMenuCaption"),Eval("DocumentName"),Eval("DocumentMenuCaption"))%>
get class of menu
<%# Eval("DocumentMenuClass") %>
then get parent menu class
sublevels in transformations
<cms:SubLevelPlaceHolder runat="server" ID="plcSub" />
{^SubLevelPlaceHolder^}
<%# CMS.DocumentEngine.TreeHelper.SelectSingleNode((int)Eval("NodeParentID")).DocumentMenuClass %>
call helper
NR.NRHelpers.ChildNodesCount(Eval("NodeID"))
where with QueryString macro
{% if (QueryString.state != "") { "State ='"+QueryString.state + "'" }|(handlesqlinjection)false #%}
if empty get parent image macro
{%BannerImage!=""?BannerImage:cmscontext.currentdocumentparent.BannerImage#%}
{%CurrentDocument.NodeClass.CodeName != "ASA.news_events"?CmsContext.CurrentDocumentParent.NodeAliasPath:""%}
If you want to get a document by its node ID, try this (assuming the uniqueness of the Node ID ;) ):
{% Documents.Where("NodeID=123456")[0].DocumentName%}
You can also get your Document by node alias path by using
{% Documents["NodeAliasPath"].DocumentName %}
get curent document
<%# CMSContext.CurrentDocument.DocumentName %>
<asp:Placeholder runat="server" ID="pl1" visible='<%# IfCompare(Eval("DocumentMenuClass"),"dropdown", IfCompare(Eval("DocumentMenuClass"),"dropdownfornews",true,false),false) %>'>
<a href="<%# GetDocumentUrl() %>"> <%#IfEmpty(Eval("DocumentMenuCaption"),Eval("DocumentName"),Eval("DocumentMenuCaption"))%></a>
</asp:Placeholder>
{%ContainerTitle%}
Global administrator password
<add key="CMSAdminEmergencyReset" value="Administrator;createnet;[true/false]" />
Columns required by the GetDocumentUrl() transformation method
DocumentURLPath, NodeAliasPath
Column required by the GetImage method in the transformations
NodeAlias