您可以在ASP中堆叠多个IF语句吗?我的没有工作

时间:2019-04-17 20:03:00

标签: asp.net

我负责我所工作的公司的电子商务网站。我对任何程序设计都是相当新的,并且大部分都是从Google那里学到的,并且这里是堆栈溢出的。

因此,如果我的工作很愚蠢或听起来不正确,对不起。

问题: 由于我们拥有1000多种产品,因此我们使用的软件利用asp将内容汇总到我们的网页中,这使我的生活更加轻松。 但是,我正在尝试编辑生成我们的元标记并且无法使IF语句起作用的源。见下文:

If (pcStrPageName = "living-in-a-printers-paradise.asp") Then

        Response.Write "<title itemprop=""name"">"""Living in a Printer's Paradise""" </title>" & vbcrlf & _ 
        "<META NAME=""description"" CONTENT="""The Wide-Format Printing Industry isn't always the easiest nor enjoyable industry to write or read about and we have decided to write for you, the reader.""" />" & vbcrlf & _ 
        "<META NAME=""Keywords"" CONTENT="""Wide Format Printers, Digital Media Warehouse Blog, Digital Media Warehouse, Large Format Printers, Wide Format Printing, Large Format Printing, Printer, Printing, Printer Blog, Printing Blog, Wide Format Printing Blog, Wide Format Printer Blog""" />" & vbcrlf & _ 
        "<META NAME=""Robots"" CONTENT=""index,follow"" />" & vbcrlf & _
        "<META NAME=""Revisit-after"" CONTENT=""30"" />" & vbcrlf
Else


        '// START - Write Meta Tags
            if trim(Title)<>"" then
                Response.Write "<TITLE itemprop=""name"">" & Title & "</TITLE>" & vbcrlf
            end if
            if trim(mtDescription)<>"" then
                Response.Write "<META NAME=""description"" CONTENT=""" & mtDescription & """ />" & vbcrlf
            end if
            if trim(Keywords)<>"" then
                Response.Write "<META NAME=""Keywords"" CONTENT=""" & Keywords & """ />" & vbcrlf
            end if

            '// No Follow on Search, Message pages, ViewCart page, Checkout pages, but Follow all others...
            If (pcStrPageName = "search.asp") OR (pcStrPageName = "msg.asp") OR (pcStrPageName = "msgb.asp") OR (pcStrPageName = "checkout.asp") OR (pcStrPageName = "onepagecheckout.asp") OR (pcStrPageName = "viewcart.asp") OR (pcStrPageName = "showsearchresults.asp") OR (sScriptName = "viewprd.asp") Then
                Response.Write "<META NAME=""Robots"" CONTENT=""noindex,nofollow"" />" & vbcrlf & _ 
                                "<META NAME=""Revisit-after"" CONTENT=""30"" />" & vbcrlf
            Else
                Response.Write "<META NAME=""Robots"" CONTENT=""index,follow"" />" & vbcrlf & _
                                "<META NAME=""Revisit-after"" CONTENT=""30"" />" & vbcrlf
            End If

            '// Add Canonical URL
            if pcStrCanonicalURL<>"" then
                'if UCase(Request.ServerVariables("HTTPS"))="ON" then
                '   pcStrCanonicalURL=replace(pcStrCanonicalURL,"http://","https://")
                'end if
                Response.Write "<link rel=""canonical"" href=""" & pcStrCanonicalURL & """ />" & vbcrlf
            end if
End If

1 个答案:

答案 0 :(得分:0)

通过更改这些设置,我有了3个“”而不是2个“”,对不起,浪费您的时间!– –p