首页 > 解决方案 > 你可以在 ASP 中堆叠多个 IF 语句吗?我的不工作

问题描述

我负责我工作的公司的电子商务网站。我对任何编程都很陌生,主要是从谷歌和这里学习堆栈溢出。

因此,如果我正在做的事情是愚蠢的或听起来不正确,我很抱歉。

问题:我们使用一个利用 ASP 的软件来为我们的网页整合内容,因为我们有超过 1000 种产品,这让我的生活更轻松。但是,我正在尝试编辑生成元标记的源,并且无法使 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

标签: asp.net

解决方案


我有 3""" 而不是 2"" 通过更改这些问题消失了。抱歉浪费您的时间!!-</p>


推荐阅读