Friday, April 12, 2024

Kentico Cheat Sheets (Notes)

 These are the common requirement during the development in Kentico. Keeping these in one place will help the developers in their productivity.

// Ternary example

<%# !string.IsNullOrEmpty((string)Eval("YourColumn")) ? "True" : "False" %>

<%# !String.IsNullOrEmpty(Eval("YourColumn").ToString()) ? "True" : "False" %>   

<%# !string.IsNullOrEmpty((string)Eval("YourColumn")) ? "<p>For detailed information and more, please visit the <a href=\"" + Eval("YourColumn") + "\" target=\"_blank\">Link text 1</a> for this column.</p>" : Eval("YourColumn") + "<br /><br /><strong>For detailed another information please visit the <a onclick=\"_gaq.push(['_trackEvent', 'Link', 'Click' 'Event Topic'])\" target=\"_blank\" href=\"" + Eval("YourColumn") + "\">Link text 2</a> for this column.</strong><br />" %>  

<%# !String.IsNullOrEmpty(Eval("Column1").ToString()) || !String.IsNullOrEmpty(Eval("Column2").ToString()) ? "<strong>Value</strong><br>" : "" %>

/* ********** */

// IfEmpty

<%# IfEmpty(Eval("ImageLink"), "", "<img src=\"" + Eval("ImageLink") + "\" class=\"alignright\" alt=\"" + Eval("DocumentName") + "\" />") %>

<%# IfEmpty(Eval("DownloadLink"), "", "<a href=\"" + Eval("DownloadLink") + "\" class=\"btn icon-download\" target=\"_blank\">Download</a>") %>

{% if (!String.IsNullOrEmpty(DocumentPageDescription)){ %}

  <p>{% DocumentPageDescription %}</p>

{% } #%}

/* ********** */

// Transformation: RegexReplace()

{% 

  replacedString = RegexReplace(YourColumn, @"[^0-9a-zA-Z\._]", string.Empty);

  return;

#%}

<p>{% replacedString %}</p>

/* ********** */

// Transformation: documents at specific path, classname

{% 

  subFolderHome = Documents["/SubFolder/Home"];

  subFolderHomeChildren = subFolderHome.Children.Where("ClassName = 'ProjectName.SubFolderHomepage'");

  return;

#%}

<ul>

{% subFolderHomeChildren.WithAllData.ApplyTransformation("ProjectName.Transformations.MainNavigation_Level_1") %}

</ul>

/* ********** */

// add 'active' class if 

{% 

  selectedPath = IsDocumentOnSelectedPath();

  isCurrent = IsCurrentDocument();

  return;

#%}

<li class="nav-item{% if( isCurrent || selectedPath ) { " active" }#%}">

  <a class="nav-link" href="{% NodeAliasPath %}">

    {% IfEmpty(DocumentMenuCaption, DocumentName, DocumentMenuCaption) %}

  </a>

</li>

/* ********** */

// Visbility

<p runat="server" Visible='<%# Eval<string>("Name") != "some-value" %>'>

<asp:Placeholder runat="server" ID="pl1" visible='<%# ... %>'>

   ...

</asp:Placeholder>

<asp:Placeholder runat="server" ID="pl2" visible='<%# !pl1.Visible %>'>

   ...

</asp:Placeholder>

<cms:QueryRepeater ID="qrConcentrations" runat="server" 

    Visible='<%# isCurrentPage(Eval<String>("nodeAlias"))%>'

    QueryName="custom.DegreePrograms.GetConcentrationsBySchoolModalityAndCategory" 

    TransformationName="custom.degreeprograms.concentrations" 

    OrderBy="v1.DegreeName ASC" 

    PagerControl-PagerHTMLBefore="<li>" 

    PagerControl-PagerHTMLAfter="</li>">

</cms:QueryRepeater>


/* check if webpart contains content, hide if no content */

{% (ViewMode != "LiveSite") || (et_sc != null && et_sc.Trim() != "") #%}

{% if ((et_sc != null && et_sc.Trim() != "") == False) { "Full-width" } else { if ((et_sc != null && et_sc.Trim() != "") == True) { "two-column" } } #%}


{% if(OfficeShowStaff == True) { return true; } else { return false; }  #%}


/* transformation: check if first record */

<%# DataItemIndex == 0 ? "First record" : "Not first record" %>


/* transformation: check if last record */

<%# DataItemIndex == DataRowView.DataView.Count - 1 ? "Last record" : "Not last record" %>

{% DataItemIndex == DataItemCount - 1 ? "Last record" : "Not last record" %}

/* transformation: `ApplyTransformation` */

{% Documents[NodeAliasPath].Children.WithAllData.ApplyTransformation("custom.VirtualMapImageGallery.CarouselGallery_Slide") #%}

{% Documents["/News"].Children.WithAllData.ApplyTransformation("custom.VirtualMapImageGallery.CarouselGallery_Slide") #%}

/* K# Examples */

// If statement

{% if (CurrentDocument.RelatedTitlesHeader == "") { "Related Books" } else { CurrentDocument.RelatedTitlesHeader } %}

{% if (bizFormField != null) { "<p>$$value:bizFormField$$</p>" } %}

// Nested if statement

{% if (CMSContext.CurrentDocument.RelativeURL == "~/georgia/rate-quote") { GetResourceString("MHI.RateQuote.Georgia") } else { if (CMSContext.CurrentDocument.RelativeURL == "~/indiana/rate-quote") { GetResourceString("MHI.RateQuote.Indiana") } else { if (CMSContext.CurrentDocument.RelativeURL == "~/oklahoma/rate-quote") { GetResourceString("MHI.RateQuote.Oklahoma") } else { if (CMSContext.CurrentDocument.RelativeURL == "~/south-carolina/rate-quote") { GetResourceString("MHI.RateQuote.SouthCarolina") }}}} #%}

// Escaping apostrophe in macro conditional

{% if (QueryString["DateSelected"]) { %} 

    CONVERT(date, EventDate) <= '{% QueryString["DateSelected"]|(handlesqlinjection)true %}' AND CONVERT(date, EventEndDate) >= '{% QueryString["DateSelected"]|(handlesqlinjection)true %}'

    {% }|(handlesqlinjection)false 

#%}

// select parent document name based on nodealiaspath

{% Documents[NodeAliasPath].Parent.DocumentName #%}

/* WebPart Visibility */

// Do NOT show if DocumentName is equal to "Home"

{%DocumentName|(notequals)Home|(truevalue){?param?}%}

// Do NOT show if NodeID is equal to "321"

{%NodeID|(notequals)321|(truevalue){?param?}%}

// Hide page(s) in the /Landing-Pages directory

{%CMSContext.CurrentDocument.NodeAliasPath|(Contains)Landing-Pages|(not)#%}

// Show if DocumentName is equal to "Home"

{%DocumentName|(equals)Home|(truevalue){?param?}%}

// Show if path contains

{%Contains(CMSContext.CurrentDocument.NodeAliasPath, "Landing-Pages")#%}

// Show if path does not contain

{%!Contains(CMSContext.CurrentDocument.NodeAliasPath, "Landing-Pages")#%}

{%not(Contains(CMSContext.CurrentDocument.NodeAliasPath, "Landing-Pages"))#%}

{% !EditedObject.NodeAliasPath.Contains("/Parts-Store") #%}

// Visibility based on Wildcard value

{%QueryString["County"] != ""%}

// Get QueryString value

{% QueryString.parameter %}

// Multiconditional

{% if (PortalContext.ViewMode == "Design") { return false; } else { if (PortalContext.ViewMode == "Edit") { return false } else { return true }} #%}

// Date format

<%# GetDateTime("BlogPostDate", "D") %>

{% CurrentDateTime.Year#%}

{% CurrentDocument.DocumentModifiedWhen.Format("{0:MM/dd/yyyy}") #%}    /* 09/12/2016 */

{% CurrentDocument.DocumentModifiedWhen.Format("{0:T}") #%}             /* 1:42:31 PM */

/* String replace */

// Kentico: Transformation, string replace, tolower

<%# Eval("DocumentName").ToString().Replace(" ", "-").ToLower() %>

/* Kentico caching long lists of data */

items = Cache(GlobalObjects.CustomTables["BCLS.Reagents"].items);

items2 = Cache(GlobalObjects.CustomTables["BCLS.FlowInstrumentsAndSoftware"].items);

// Resolve Localization strings in transformation

<%# ResHelper.LocalizeString("{$Autobag.SpareParts.Btn_AddToRFQ$}") %>

PersonDivision LIKE '%{% QueryString["School"].ToString().Replace("-", " ").ToLower() %}%' and PersonIsFacultyLeader = 1

/* Get Custom Table data using macro */

{% GlobalObjects.CustomTables["customtable.SampleTable"].Items[3].GetValue("ItemText") %}

/* Set site to non-https from db */

update CMS_SettingsKey

  set KeyValue='False'

  where KeyName='CMSUseSSLForAdministrationInterface'

  update CMS_Tree

  set IsSecuredNode= NULL, RequiresSSL=NULL

/* jquery ajax call example */

$.ajax({

  url: 'http://localhost/rest/content/currentsite/all?classnames=claremont.LocationContentBlock&hash=12c0c34e0ee345c1e1d5679a56b7efe4567d0a6b08f6a9b05a264be4657c8702',

  dataType: 'xml',

  success: function(xml, status, xhr) {

    $(xml).find('claremont_LocationContentBlock').each(function() {

      var name = $(this).find('DocumentName').text();

      var location = $(this).find('NodeAlias').text();

      var zip = $(this).find('ZipCode').text();

      $('<li>' + zip + ' - ' + name + ' (' + location + ')' + '</li>').appendTo('#zipCodes');

      $('<p>' + zip + '</p>').appendTo('#rawData');

    });

    console.log('Status: ' + xhr.statusText);

  },

  error: function(xhr, status, error) {

    console.log('Error occurred: ' + xhr.statusText);

  }

});

/* Dates */

<%# FormatDateTime(Eval("EventDate"), "MMMM d") %>

<%# IfEmpty(Eval("EventEndDate"), "", IfCompare(FormatDateTime(Eval("EventDate"), "MMM d"), FormatDateTime(Eval("EventEndDate"), "MMM d"), " - " + IfCompare(Eval<DateTime>("EventDate").Month, Eval<DateTime>("EventEndDate").Month, FormatDateTime(Eval("EventEndDate"), "MMMM d"), FormatDateTime(Eval("EventEndDate"), " d")), "")) %>

/* Format Numbers */

<%# String.Format("{0:n}", Int64.Parse(Eval("Field").ToString())) %>    // 100,000.00

<%# String.Format("{0:n0}", Int64.Parse(Eval("Field").ToString())) %>   // 100,000

<%# String.Format("{0:C}", Eval("TotalPriceIncludingOptions")) %>

/* sql */

/* populate dropdowns */

SELECT Code as Value, Code as Name FROM MyCodeTable

SELECT Location AS Code, Location FROM customtable_ConferenceLocations

SELECT REPLACE(Location, ' ','-') AS Code, Location FROM customtable_ConferenceLocations

SELECT '' AS Code, '-- Select Location --' AS Location

    UNION

SELECT Location AS Code, Location 

FROM customtable_ConferenceLocations

/* Check current version and hotfix version */

SELECT *

FROM CMS_SettingsKey

WHERE KeyName = 'CMSDataVersion' OR

KeyName = 'CMSDBVersion' OR

KeyName = 'CMSHotfixVersion'

/* get document by categories */

SELECT DocumentName

FROM View_CMS_Tree_Joined

WHERE DocumentID IN (Select DocumentID FROM CMS_DocumentCategory WHERE CategoryID in (Select CategoryID from CMS_Category where CategoryName IN ('News', 'FAQs')))

/* Custom table control settings */

Custom table item selector form control: https://www.screencast.com/t/slxjPobM

/* transformation: custom variable */

{%

  myVariable = ( !String.IsNullOrWhiteSpace( DocumentMenuCaption ) ) ? DocumentMenuCaption : DocumentName;

  return;

#%}

<a href="GetDocumentUrl()">{% myVariable %}</a>

/* pipe delimited list */

{% if (!String.IsNullOrEmpty(LocationFeaturesList)) { %}

  <ul class="list-unstyled text-primary lead mb-3">

    <li>{% LocationFeaturesList.ToString().Replace("|","</li><li>") %}</li>

  </ul>    

{% } #%}

/* CSS cache busting  */

<link href="~/CMSPages/GetResource.ashx?stylesheetname=<CODE_NAME>&vid={% GlobalObjects.CssStylesheets.<CODE_NAME>.StylesheetVersionGUID #%}" type="text/css" rel="stylesheet"/>

Wednesday, April 1, 2015

Implement Publish From and Publish To feature in Kentico custom table

Show Documents Where IsPublished = 'true'( PublishFromDate and PublishToDate). SQL Query to Resulting the above requirement

Below is the example how to fetch the published tree node items. You can create your custom table with ItemPublishedFrom and ItemPublishedTo column and provide IsPublished functionality to that custom table. I am sure this will help you a lot while you need the publish feature on custom table. So why you should create a page type instead a custom table to do a simple functionality.

Select * from [dbo].[View_GTH_Seller_Joined] Where  DocumentCulture ='en-au'
AND (DocumentPublishFrom <= GetDate() OR DocumentPublishFrom IS NULL)  AND (DocumentPublishTo >= GetDate() OR  DocumentPublishTo IS NULL)


Tuesday, October 2, 2012

Kentico Macro Examples

Macros

Please find the list of macros below. You can also jump to a section using the following links:
ApplicationPath
Syntax:{%applicationpath%}
Returns:UrlHelper.GetApplicationPath().TrimEnd('/') - Application path
AppPath
Syntax:{%apppath%}
Returns:UrlHelper.GetApplicationPath().TrimEnd('/') - Application path
CurrentCulture
Syntax:{%currentculture%}
Returns:CultureHelper.GetPreferredCulture() - Current culture
CurrentDate
Syntax:{%currentdate%}
Returns:DateTime.Now.ToShortDateString()
CurrentDateTime
Syntax:{%currentdatetime%}
Returns:DateTime.Now
CurrentTime
Syntax:{%currenttime%}
Returns:DateTime.Now.ToShortTimeString()
CurrentUrl
Syntax:{%currenturl%}
Returns:UrlHelper.CurrentURL - Current URL (new in 5.5)
Domain
Syntax:{%domain%}
Returns:UrlHelper.GetCurrentDomain() - Domain
EmptyString
Syntax:{%EmptyString%}
Returns:String.Empty
Ip
Syntax:{%ip%}
Returns:HTTPHelper.GetUserHostAddress() - Client's IP address
Now
Syntax:{%now%}
Returns:DateTime.Now
Pi
Syntax:{%Pi%}
Returns:Math.PI
Zero
Syntax:{%Zero%}
Returns:0
Example:{%Zero|(add)5%}
CMSContext.CurrentAttachment
Syntax:{%cmscontext.currentattachment%}
CMSContext.CurrentDocument
Syntax:{%cmscontext.currentdocument%}
CMSContext.CurrentDocumentCulture
Syntax:{%cmscontext.currentdocumentculture%}
CMSContext.CurrentDocumentOwner
Syntax:{%cmscontext.currentdocumentowner%}
CMSContext.CurrentDocumentParent
Syntax:{%cmscontext.currentdocumentparent%}
CMSContext.CurrentPageInfo
Syntax:{%cmscontext.currentpageinfo%}
CMSContext.CurrentSite
Syntax:{%cmscontext.currentsite%}
CMSContext.CurrentTemplate
Syntax:{%cmscontext.currenttemplate%}
CMSContext.CurrentUser
Syntax:{%cmscontext.currentuser%}
CommunityContext.CurrentFriend
Syntax:{%communitycontext.currentfriend%}
CommunityContext.CurrentFriendship
Syntax:{%communitycontext.currentfriendship%}
CommunityContext.CurrentGroup
Syntax:{%communitycontext.currentgroup%}
ECommerceContext.CurrentCurrency
Syntax:{%ecommercecontext.currentcurrency%}
ECommerceContext.CurrentCustomer
Syntax:{%ecommercecontext.currentcustomer%}
ECommerceContext.CurrentCustomerCountry
Syntax:{%ecommercecontext.currentcustomercountry%}
ECommerceContext.CurrentCustomerState
Syntax:{%ecommercecontext.currentcustomerstate%}
ECommerceContext.CurrentExchangeRate
Syntax:{%ecommercecontext.currentexchangerate%}
ECommerceContext.CurrentProduct
Syntax:{%ecommercecontext.currentproduct%}
ECommerceContext.CurrentProductDepartment
Syntax:{%ecommercecontext.currentproductdepartment%}
ECommerceContext.CurrentProductInternalStatus
Syntax:{%ecommercecontext.currentproductinternalstatus%}
ECommerceContext.CurrentProductPublicStatus
Syntax:{%ecommercecontext.currentproductpublicstatus%}
ECommerceContext.CurrentProductSupplier
Syntax:{%ecommercecontext.currentproductsupplier%}
ECommerceContext.CurrentShoppingCart
Syntax:{%ecommercecontext.currentshoppingcart%}
ForumContext.CurrentForum
Syntax:{%forumcontext.currentforum%}
ForumContext.CurrentGroup
Syntax:{%forumcontext.currentgroup%}
ForumContext.CurrentPost
Syntax:{%forumcontext.currentpost%}
ForumContext.CurrentThread
Syntax:{%forumcontext.currentthread%}
MediaLibraryContext.CurrentMediaFile
Syntax:{%medialibrarycontext.currentmediafile%}
MediaLibraryContext.CurrentMediaLibrary
Syntax:{%medialibrarycontext.currentmedialibrary%}
PortalContext.ViewMode
Syntax:{%portalcontext.viewmode%}
SiteContext.CurrentUser
Syntax:{%sitecontext.currentuser%}
add
Syntax:|(add)<number>
Returns:Adds the value
append
Syntax:|(append)<string>
Returns:Appends (suffixes) the given string to the value
Example:{%Zero|(append)ABC%} returns 0ABC
clear
Syntax:|(clear)
Returns:Clears current value to produce empty result
contains
Syntax:|(contains)<string>
Returns:True if value contains given string
cos
Syntax:|(cos)
Returns:Cosine
Example:{%Something|(cos)%}
culture
Syntax:|(culture)<code>
Returns:Returns the value in specified culture
Example:{%SKUPrice|(culture)en-us%} writes the product price in an English culture formatting
default
Syntax:|(default)<value>
Returns:Default value (if value is not found)
Example:{%SKUPrice|N/A%} writes product price or N/A if the document is not a product
divide
Syntax:|(divide)<value>
Returns:Divides the value by the given number
Example:{%Something|(divide)3%}
encode
Syntax:|(encode)<true/false>
Returns:HTMLHelper.HTMLEncode
Example:{%DocumentName|(encode)true%} or {%DocumentName|(encode)%} writes the HTML encoded document name, such as Black & white
endswith
Syntax:|(endswith)<string>
Returns:True if value ends with given string
equals
Syntax:(equals)<value>
Returns:Returns “true” if the resolved value matches the given value, else returns “false”. Uses the (truevalue), (falsevalue) settings for the output.
Example:{%UserName|(equals)administrator%} writes true if the user is administrator
escape
Syntax:(operation)\|(operation)
Returns:Escapes the macro
Example:{%CurrentUserName|(append)\|(you)%}
falsevalue
Syntax:|(falsevalue)<value>
Returns:Output settings for the negative output of the comparisson
Example:{%UserName|(equals)administrator|(truevalue)Yes|(falsevalue)No%} writes No if the user is not administrator
format
Syntax:|(format)<format>
Returns:Formatted value
Example:{%SKUPrice|(format){0:f1}%} writes the product price with precision for one decimal place
getmatch
Syntax:|(getmatch)<regex>
Returns:Regex.Match
Example:{%CurrentDocument.DocumentName|(getmatch)[k-r]%} will result in "om" on "Home"
greaterthan
Syntax:|(greaterthan)<number>
Returns:True if current value is greater than given number
handlesqlinjection
Syntax:|(handlesqlinjection)
Returns:Resolver will handle the SQL injection of the result
jsescape
Syntax:|(jsescape)
Returns:Replaces quotes and \n (javascript escapes)
limitlength
Syntax:|(limitlength)<chars>
Returns:TextHelper.LimitLength
lowerthan
Syntax:|(lowerthan)<number>
Returns:True if current value is lower than given number
mappath
Syntax:|(mappath)
Returns:Maps the virtual path to the physical path
Example:Maps ~/Home.aspx to C:\Inetpub\wwwroot\KenticoCMS\Home.aspx
matches
Syntax:|(matches)<regex>
Returns:True if regular expression matched on the given value
multiply
Syntax:|(multiply)<number>
Returns:Multiplies the value
not
Syntax:|(not)
Returns:Negates current value
notequals
Syntax:|(notequals)<value>
Returns:Returns “false” if the resolved value matches the given value, else returns “true”. Uses the (truevalue), (falsevalue) settings for the output.
Example:{%UserName|(notequals)administrator%} – Writes false if the user is administrator
notrecursive
Syntax:|(notrecursive)
Returns:Explicitly disables the recursion of the macros
padleft
Syntax:|(padleft)<total width>, |(padleft)<total width>(with)<char>
Returns:Makes sure that the string has total width of characters, filling the blanks with space
Example:{%Zero|(add)5|(padleft)3(with)0%} returns 005
padright
Syntax:|(padright)<total width>, |(padright)<total width>(with)<char>
Returns:Makes sure that the string has total width of characters, filling the blanks with space
pow
Syntax:|(pow)<value>
Returns:Raises the first argument to the power of the second argument
Example:{%Something|(pow)2%}
prepend
Syntax:|(prepend)<string>
Returns:Prepends (prefixes) the given string to the value
Example:{%Zero|(prepend)ABC%} returns ABC0
regexreplace
Syntax:|(regexreplace)<regex>(with)<dest>
Returns:Replaces the source string with the destination string using regular expressions
replace
Syntax:|(replace)<src>(with)<dest>
Returns:Replaces the source string with the destination string
Example:{%CurrentDocument.DocumentName|(replace)e(with)er%} on "Home" will result in "Homer"
resolve
Syntax:|(resolve)
Returns:Resolves macros
resolvebbcode
Syntax:(resolvebbcode)<true/false>
Returns:Resolves the BB code in the result of the macro
Example:{%MessageText|(resolvebbcode)true%} or {%MessageText|(resolvebbcode)%} writes the resolved BB code such as conversion of [url]… to <a href="…
resolveurl
Syntax:|(resolveurl)
Returns:Resolves the virtual path or URL
Example:Converts ~/Home.aspx to /KenticoCMS/Home.aspx
saveas
Syntax:|(saveas)<key>
Returns:Saves current value to the selector (under current resolving context)
sin
Syntax:|(sin)
Returns:Sine
Example:{%Something|(sin)%}
sqlescape
Syntax:|(sqlescape)
Returns:Replaces ' with '' (SQL escapes)
sqrt
Syntax:|(sqrt)
Returns:Square root
Example:{%Something|(sqrt)%}
startswith
Syntax:|(startswith)<string>
Returns:True if value starts with given string
striptags
Syntax:|(striptags)
Returns:HTMLHelper.StripTags
substring
Syntax:|(substring)<start>, |(substring)<start>;<length>
Returns:The part of the string after the given index
Example:{%CurrentDocument.DocumentName|(substring)1;3%} on document "News" will give you "ews"
tan
Syntax:|(tan)
Returns:Tangent
Example:{%Something|(tan)%}
tobool
Syntax:(tobool)<default value>
Returns:Conversion to Boolean, uses the (truevalue), (falsevalue) settings as a result
Example:{?onlyvalid|(tobool)true?} writes false if onlyvalid querystring parameter is false, else returns true
todatetime
Syntax:(todatetime)<default value>
Returns:Conversion to DateTime, uses the (culture) settings
Example:{?targettime|(todatetime)?} converts the targettime query parameter to date time or DateTime.MinValue
todouble
Syntax:(todouble)<default value>
Returns:Conversion to Double (uses the culture settings)
Example:{?price|(todouble)10.2?} converts the price query parameter to double or 10.2
toguid
Syntax:(toguid)<default value>
Returns:Conversion to GUID
Example:{?userguid|(toguid)?} converts the userguid query parameter to Guid or Guid.Empty
toint
Syntax:(toint)<default value>
Returns:Converts the result to integer, if not successful, uses the default value.
Example:{?tagid|(toint)0?} writes the valid tagid from querystring or 0 if not valid
tolower
Syntax:|(tolower)<true>
Returns:Converts the result to lowercase
Example:{%DocumentName|(tolower)true%} or {%DocumentName|(tolower)%} writes black & white
toupper
Syntax:|(toupper)<true>
Returns:Converts the result to uppercase
Example:{%DocumentName|(toupper)true%} or {%DocumentName|(toupper)%} writes BLACK & WHITE
trim
Syntax:|(trim), |(trim)<chars>
Returns:Removes the white spaces on the beginning and end of the value
Example:{%EmptyString|(append)ABCD|(trim)AD%} returns BC
trimend
Syntax:|(trimend), |(trimend)<chars>
Returns:Does the trimming only on the end of the string
trimstart
Syntax:|(trimstart), |(trimstart)<chars>
Returns:Does the trimming only on the end of the string
truevalue
Syntax:|(truevalue)<value>
Returns:Output settings for the positive output of the comparisson
Example:{%UserName|(equals)administrator|(truevalue)Yes|(falsevalue)No%} writes Yes if the user is administrator
unresolveurl
Syntax:|(unresolveurl)
Returns:Unresolves the URL
urlencode
Syntax:|(urlencode)<true/false>
Returns:HttpUtility.UrlEncode
Example:{%DocumentName|(urlencode)true%} or {%DocumentName|(urlencode)%} writes the URL encoded document name, such as All%20items
Nested
Syntax:{%Something|(equals)Something|(truevalue){(1)%Something%(1)}%}
Returns:Nested macro
Example:{%DocumentName|(equals)Home|(truevalue){(1)%param%(1)}%}
Nested #2
Syntax:{%Something|(equals)Something|(truevalue){(1)%Something%(1)}%}
Returns:Nested macro
Example:{%DocumentMenuCaption|(equals)|(truevalue){(1)%DocumentName%(1)}|(falsevalue){(2)%DocumentMenuCaption%(2)}%}
Nested #3
Syntax:{%Something|(equals)Something|(truevalue){(1)%Something%(1)}%}
Returns:Nested macro
Example:{(1)%DocumentMenuCaption|(equals)|(truevalue){(2)%DocumentName%(2)}|(falsevalue){(3)%DocumentMenuCaption%(3)}%(1)}
Web part container title (nested)
Syntax:{%Something|(equals)Something|(truevalue){(1)%Something%(1)}%}
Returns:Nested macro
Example:{(1)%ContainerTitle|(equals)|(truevalue)|(falsevalue)<h2>{(2)%ContainerTitle%(2)}</h2>%(1)}