0

我有这个代码,

#if ($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8)

在 Liferay 的页面布局中告诉他们为浏览器 IE 7 使用基于表格的布局,但我收到以下警告:

Invalid character used in text string ( #if($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8) ).

问题似乎是 AND (&&) 参数,但我没有看到任何问题。所以,如果有人能告诉我问题是什么,我将不胜感激。

在此先感谢,阿迪亚。


更新:布局文件

<div class="default-page-template" id="main-content" role="main">
   #if ($browserSniffer.isIe($request) && $browserSniffer.getMajorVersion($request) < 8)
    <table class="portlet-layout">
            <tr>
                <td class="portlet-column portlet-column-first" id="column-1">
                    $processor.processColumn("column-1", "portlet-column-content portlet-column-content-first")
                </td>
                <td class="portlet-column portlet-column-last" id="column-2">
                    $processor.processColumn("column-2", "portlet-column-content portlet-column-content-last")
                </td>
            </tr>
        </table>

        <table>
            <tr>
                <td class="portlet-column portlet-column-first" id="column-3">
                    $processor.processColumn("column-3", "portlet-column-content portlet-column-content-first")
                </td>
            </tr>
        </table>

        <table class="portlet-layout">
            <tr>
                <td class="portlet-column portlet-column-first" id="column-4">
                    $processor.processColumn("column-4", "portlet-column-content portlet-column-content-first")
                </td>
                <td class="portlet-column" id="column-5">
                    $processor.processColumn("column-5", "portlet-column-content portlet-column-content-last")
                </td>
                <td class="portlet-column portlet-column-last" id="column-6">
                    $processor.processColumn("column-6", "portlet-column-content portlet-column-content-last")
                </td>
            </tr>
        </table>

        <table class="portlet-layout">
            <tr>
                <td class="portlet-column portlet-column-last" id="column-7">
                    $processor.processColumn("column-7", "portlet-column-content portlet-column-content-last")
                </td>
            </tr>
        </table> 
    #else
        <div class="portlet-layout">
            <div class="portlet-column portlet-column-first" id="column-1">
                $processor.processColumn("column-1", "portlet-column-content portlet-column-content-first")
            </div>

            <div class="portlet-column portlet-column-last" id="column-2">
                $processor.processColumn("column-2", "portlet-column-content portlet-column-content-last")
            </div>
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-first" id="column-3">  
                $processor.processColumn("column-3", "portlet-column-content portlet-column-content-first")
            </div>
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-first" id="column-4">
               $processor.processColumn("column-4", "portlet-column-content portlet-column-content-first")
            </div>

            <div class="portlet-column" id="column-5">
                $processor.processColumn("column-5", "portlet-column-content portlet-column-content-last")
            </div>

            <div class="portlet-column portlet-column-last" id="column-6">
            $processor.processColumn("column-6", "portlet-column-content portlet-column-content-last")
            </div>          
        </div>

        <div class="portlet-layout">
            <div class="portlet-column portlet-column-first" id="column-7">
                $processor.processColumn("column-7", "portlet-column-content portlet-column-content-first")
            </div>
        </div>

    #end
</div>
4

1 回答 1

0

您可以轻松确定和解决 && 问题,如果这确实是问题 - 尽管它是速度处理逻辑运算符的方式:

#if ($browserSniffer.isIe($request))
  #if($browserSniffer.getMajorVersion($request) < 8)
     ... (your stuff here)
  #end
#end

如果不是,至少您在语句的一半中收到新的错误消息,并且可以从那里继续调试。

你在什么样的文件里有这个?布局模板?主题?

于 2012-08-15T12:25:44.533 回答