Skip to content

Instantly share code, notes, and snippets.

@contensis
Last active August 29, 2015 14:03
Show Gist options
  • Save contensis/07bb66a5d7ff118ba288 to your computer and use it in GitHub Desktop.
Save contensis/07bb66a5d7ff118ba288 to your computer and use it in GitHub Desktop.
'-----------------------------------
' Contensis - Custom Code (Page PreLoad)
'
' Add to your base template
'
' Append the content version number to CSS Link URL to prevent caching
' e.g. <link href="/siteelements/assets/css/main.css?version=81002" rel="stylesheet" type="text/css" />
'
'-----------------------------------
For Each item As CMS_API.Utilities.controls.StyleSheet In StyleSheets.Controls
Dim FolderID as integer = CMS_API.Utilities.NavigationXMLHelper.Instance.GetFolderIDFromPath(System.IO.Path.GetDirectoryName(item.href).replace("\","/"))
Dim ContentID as integer = CMS_API.Utilities.NavigationXMLHelper.Instance.GetFolderChildByName(FolderID,System.IO.Path.GetFileNameWithoutExtension(item.href),CMS_API.Utilities.NavigationXMLHelper.MenuType.contentitem)
Dim Element As System.XML.XmlElement = CMS_API.Utilities.NavigationXMLHelper.Instance.GetContentElement(ContentID)
'response.write(ContentID)
If Element IsNot Nothing Then
If Element.Attributes("version") IsNot Nothing Then
item.Href += "?version=" & Element.Attributes("version").Value
End If
End If
Next
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment