vbscript各种自定义代码片段-有关详细信息,请参阅注释(代码片段)

author author     2023-01-24     759

关键词:

////////////////////////////////////////////////////////
***Set a datafilter on a control using the current folder***

Dim SectionFolderID As Integer

SectionFolderID = CurrentNode.Data.Property_F_ID
Dim DataFilter As New CMS_API.Data.DataFilterExpression("", CMS_API.Data.DataFilterFunction.Custom, "(Property_F_ID LIKE " & SectionFolderID & ")")
FAQListing.DataFilters.Add(DataFilter)

////////////////////////////////////////////////////////

  'add a script at the end of the body tag
CurrentContext.Page.Scripts.Add("/NewGenerationSite/j/eventsjs.js", ScriptLocation.BodyEnd);

  // code for collapsing a placeholder based on whether there are subtemplates or text inside it.

if Control.controls.count = 0 andalso (value = "" OrElse value= "[add mini-templates here]") then
sideColumn.visible = false
mainColumn.attributes("class")= mainColumn.attributes("class") & " sys_col1-expanded"
response.write("hide")
else
response.write("has controls")
end if
exit sub

///### THis first one works ###///
If Control.controls.count = 0 then
                If value.trim.toLower.indexof("[add … here]") > -1 Or StripHTML(HttpUtility.HTMLDecode(value).trim).length = 0 Or StripHTML(value).trim() = " " then
                                Control.Parent.visible = false
                End If
End If


If Control.controls.count = 0 then
    If value.trim.toLower.indexof("[add content here]") > -1 Or StripHTML(HttpUtility.HTMLDecode(value).trim).length = 0 then
        Control.visible = false
    End If
End If


If Control.controls.count = 0 then
        If value.indexof("<img") = -1 then
                If StripHTML(HttpUtility.HTMLDecode(value).trim).length = 0 then
                        Control.visible = false
                         
                Else
                        If value.trim.toLower.indexof("insert a link") > -1 then
                        Control.visible = false
                        End If
                  
            End If
        End If
End If
    
    
    
    ------------------------------------------------------------------------------------------------

// code for hiding divs (set div to runat="server" first!)

name of div ID here.visible = false

------------------------------------------------------------------------------------------------

//Code for adding Javascript files 

//Jquery 

Utilities.RegisterJquery

//jQuery R8

AppContext.Current.Page.Scripts.RegisterJQuery()

//r6
Utilities.RegisterJavaScriptFile("/SiteElements/Scripts/tabbox.js")

//R7.2
CurrentContext.Page.Scripts.Add("/SiteElements/Scripts/checkbox.js")

//Add javascript just before the closing body tag
 
Javascript.StartUpJavascriptFiles.Add("/SiteElements/Scripts/flexslider.js") 

//Code for adding stylesheets in custom code

CurrentContext.Page.CSS.Add("/SiteElements/Stylesheets/550-structuredContent.css")

------------------------------------------------------------------------------------------------
      
      
// If statement based on current page id

if me.ContentId = < > etc 1 then
[do something]
end if

//for example;

if me.ContentId <> 1 then
TitleBar.text = TitleBar.text & " -Page Title"
end if

** "else" and "elseif" can also be used. Not is done by using "if not"

------------------------------------------------------------------------------------------------

'Add conditional CSS files to head
    ContensisHeader.Text += "<!--[if lte IE 7]>" & Environment.Newline
    ContensisHeader.Text += "<link rel=""stylesheet"" type=""text/css"" href=""/SiteElements/Styles/901-ie7.css"" />" & Environment.Newline
    ContensisHeader.Text += "<![endif]-->" & Environment.Newline
    
    ContensisHeader.Text += "<!--[if lte IE 9]>" & Environment.Newline
    ContensisHeader.Text += "<script type=""text/javascript"" src=""SiteElements/Javascript/compat.js""></script>" & Environment.Newline
    ContensisHeader.Text += "<![endif]-->" & Environment.Newline

// Text in footer?

FooterLit.Text = "<scr" & "ipt type=""text/javascript"" src=""/SiteElements/Javascripts/fixpng.js""></scr" & "ipt><noscript>Warning: png images may not display correctly as your browser does not support JavaScript.</noscript>"

-------------------------------------------------------------------------------------------------

'Add responsive meta tag thingy

    ContensisHeader.Text += "<meta name=""viewport"" content=""width=device-width, initial-scale=1"">" & Environment.Newline

-------------------------------------------------------------------------------------------------   
          
          
          
          
          // LANGUAGE Selection

'Customised Language Toggle Link
Dim contentId As Integer = Property_c_id
Dim url As String = ""

'Try
    'If on en page
'    If Property_PageLanguageId = 1 Then
'        LanguageToggleHyperlink.Text = "Cymraeg"
'        Dim navProvider As CMS_API.Navigation.NavigationProvider = CMS_API.Navigation.NavigationProviderFactory.GetNavigationProvider(CMS_API.Navigation.NavigationProviderType.Xml)
'        Dim navContent As CMS_API.Navigation.INavigationContent = CType(navProvider.GetItemByDatabaseID(contentId, CMS_API.Navigation.NavigationItemTypes.Webpage), CMS_API.Navigation.INavigationContent)
       
'        if navContent.SlaveNavigationContentList.count > 0 then
'            url = navContent.SlaveNavigationContentList(0).Url
            'response.write(url)
'            LanguageToggleHyperlink.NavigateUrl = url
'        end if
'    Else If Property_PageLanguageId = 8 Then
'            LanguageToggleHyperlink.Text = "English"
'            Dim navXmlHelper As CMS_API.Utilities.NavigationXMLHelper = CMS_API.Utilities.NavigationXMLHelper.Instance
'            Dim xmlId As String = navXmlHelper.GetElementXmlId(contentId, CMS_API.Utilities.NavigationXMLHelper.MenuType.pageitem)
'            Dim masterContentID As Integer = navXmlHelper.GetElementMasterContentId(xmlId)
    
'            url = System.Web.HttpUtility.HtmlEncode(CMS_API.Utilities.NavigationXMLHelper.Instance.GetPagePath(masterContentID))
'            LanguageToggleHyperlink.NavigateUrl = url
            
            'Search redirect
'            SearchQueryControl.resultsurlwebpageid = 23522
'    End If
'Catch Ex As Exception
    'Toggle link uses default setting and goes to cy homepage
'End Try
      

vbscript使用webapi在自定义代码中添加ie样式表(代码片段)

查看详情

vbscript自定义函数根据条件连接到或多个字符串。(代码片段)

查看详情

php事件日历:在列表场所组织者短信代码扩展的项目详细信息部分中显示wordpress自定义字段。(代码片段)

查看详情

vbscript在每张纸上执行相同的操作。编辑第二个子例程以进行自定义(代码片段)

查看详情

有关cookies与session的详细信息(代码片段)

COOKIES与SESSION详细信息参考:https://www.cnblogs.com/linguoguo/p/5106618.html 会话(Session)跟踪是Web程序中常用的技术,用来跟踪用户的整个会话。常用的会话跟踪技术是Cookie与Session。Cookie通过在客户端记录信息确定用户身份,Session... 查看详情

sql有关ng-security-service的re详细信息(代码片段)

查看详情

powershellpowershell:获取有关策略和扩展上次策略时间的组策略详细信息(代码片段)

查看详情

自定义注解,通过反射获得注解中的值(详细自定义注解解释)(代码片段)

自定义注解(@Alias):packagecom.nf.lc.demo3;importjava.lang.annotation.*;/*定义注解的生命周期元注解:@RetentionRetentionPolicy.SOURCE在编译阶段丢弃,编译结束没有任何意义RetentionPolicy.CLASS在类加载时丢弃,字节码文件处理时有用,默认这种方... 查看详情

一个或多个实体的验证失败。有关详细信息,请参阅“entityvalidationerrors”属性(代码片段)

我在使用代码优先方法播种数据库时遇到此错误。一个或多个实体的验证失败。有关详细信息,请参阅“EntityValidationErrors”属性。说实话,我不知道如何检查验证错误的内容。VisualStudio向我显示它是一个包含8个对象的数组,因... 查看详情

php[约会]-其他自定义字段演示。有关如何在appointmentslite中添加自定义字段的指南(代码片段)

查看详情

vbscript如果占位符为空或具有默认内容,请将其隐藏。在自定义代码选项卡中添加相关代码。如果你想添加一个类wh(代码片段)

查看详情

vbscript将字段信息写入范围(代码片段)

查看详情

vbscript将表信息写入范围(代码片段)

查看详情

自定义responseresult在controller响应信息主体和自定义全局及局部异常中的实现(代码片段)

前言:在controller及hanlder的消息返回给客户端的json对象信息,一般是自定义的,输出格式是json格式!自定义详细编号HttpEnum/***<b><code>HttpEnum</code></b>*<p>*Description*</p>*<b& 查看详情

andorid自定义attr的各种坑(代码片段)

...孙有军在开发Andorid应用程序中,经常会自定义View来实现各种各样炫酷的效果,在实现这吊炸天效果的同时,我们往往会定义很多attr属性,这样就可以在XML中配置我们想要的属性值,以下就是定义属性值可能遇到的各种坑。大家... 查看详情

andorid自定义attr的各种坑(代码片段)

...孙有军在开发Andorid应用程序中,经常会自定义View来实现各种各样炫酷的效果,在实现这吊炸天效果的同时,我们往往会定义很多attr属性,这样就可以在XML中配置我们想要的属性值,以下就是定义属性值可能遇到的各种坑。大家... 查看详情

添加具有订单详细信息功能的自定义按钮 - Magento 2

】添加具有订单详细信息功能的自定义按钮-Magento2【英文标题】:AddCustomButtonwithFunctionalitytoOrderDetail-Magento2【发布时间】:2021-12-1111:27:11【问题描述】:我正在尝试向管理订单详细信息页面添加自定义按钮。使用下面的代码,按... 查看详情

执行命令定义时发生错误。有关详细信息,请参阅内部异常 (linq)

】执行命令定义时发生错误。有关详细信息,请参阅内部异常(linq)【英文标题】:Anerroroccurredwhileexecutingthecommanddefinition.Seetheinnerexceptionfordetails(linq)【发布时间】:2013-10-0813:02:58【问题描述】:由于我是实体框架和linq的新手,所... 查看详情