html
  • xml
  • blogger
  • 2017-07-03 132 views 1 likes 
    1

    我爲不同的頁面使用自定義標題圖片。 我有一個共同的標題索引頁&我將用於搜索頁面。Blogger搜索條件聲明

    以下是AND條件顯示索引頁面標題的代碼,僅適用於不適用於搜索頁面的索引頁面。

    <b:if cond='data:blog.pageType == "index"'> 
     
    <b:if cond='data:blog.pageType!= data:blog.searchQuery'> 
     
    <div class='picheader'> 
     
    <img alt='abc' src='image url' style='width:500px;height:300px;'/> 
     
        <br/><br/> 
     
    <div style='font-size:25px; text-shadow: 2px 1px grey;'>What we do ?</div> 
     
    Our description 
     
    </div> 
     
    </b:if> 
     
    </b:if> 
     
    
     
    <!-- Only for search page --> 
     
    <b:if cond='data:blog.searchQuery'> 
     
    <div class='picheader'> 
     
    <img alt='Search Page' src='image url' style='width:500px;height:300px;'/> 
     
        <br/><br/> 
     
    <div style='font-size:25px; text-shadow: 2px 1px grey;'>Search Anything</div> 
     
    Looking for something... 
     
    </div> 
     
    </b:if>

    但有了這個代碼,索引頁是好的,但索引頁標題也與搜索頁頭加載。 如何解決這個問題?

    回答

    2

    試試這個代碼:

    <!-- If it is an Index page --> 
    <b:if cond='data:blog.pageType == "index"'> 
    
        <!-- If it is search page --> 
        <b:if cond='data:blog.searchQuery'> 
        <div class='picheader'> 
         <img alt='Search Page' src='image url' style='width:500px;height:300px;'/> 
         <br/><br/> 
         <div style='font-size:25px; text-shadow: 2px 1px grey;'>Search Anything</div> 
         Looking for something... 
        </div> 
    
        <!-- If it is an Index page but not Search page --> 
        <b:else/> 
        <div class='picheader'> 
         <img alt='abc' src='image url' style='width:500px;height:300px;'/> 
         <br/><br/> 
         <div style='font-size:25px; text-shadow: 2px 1px grey;'>What we do ?</div> 
         Our description 
        </div> 
        </b:if> 
    
    </b:if> 
    

    條件data:blog.pageType != data:blog.searchQuery將始終返回true(除非你搜索 '索引')。這也是它在搜索頁上顯示的原因。

    +0

    謝謝你糾正我,只是工作得很好! – mimi

    相關問題