如何有条件地隐藏视图中的全局自定义文本中的html

Am using drupal 7 views and I have this global custom text to be shown

<div class="book_content">
 <span>[date]<span>
 <div class="book_description">
  [discription]
 </div>
 <a href="book_url">Book</a>
</div>

My problem is that I want to hide <a href="book_url">Book</a> if date < now , what's the best way to do it

Try something like this

<div class="book_content">
 <span>[date]<span>
 <div class="book_description">
  [discription]
 </div>
 <?php if (time() >= strtotime($targetTime)): ?>
 <a href="book_url">Book</a>
 <?php endif; ?>
</div>

The best way is to use View PHP module.https://www.drupal.org/project/views_php

After you've installed this module, go to you're view and add a Global PHP field.

<?php
print '<div class="book_content">'
         <span>[date]<span>
         <div class="book_description">
          [discription]
        </div>';

$now = time();
$date = '2015/03/12';

if (strtotime($date) < $now) {
    <a href="book_url">Book</a>
}
print '</div>';
?>

Make sure you add this code in Output code text and save the field. Refer to this screenshot -> Screenshot. You might want to remove Global text field so as to avoid duplication of fields. Do remember to use the sample code with php directives as given.

Hope this helps! :)