dongzhi9032 2011-11-23 17:47
浏览 40
已采纳

在PHP中检查参数类

At the moment, I have the following:

<?php if ($custom != ""): ?> 
    <div class="head-row5" id="custom">
        <?php print $custom?>                    
    </div><?php //head-row5 ?>                  
<?php endif; ?>

What is returned is something like....

<div class="block block-block" id="block-block-15">
    <div class="title">
        <h3></h3>
    </div>
    <div class="content"><p style="text-align: center;"><a href="website linkage" id="T2roll"><span class="alt">Name of the linked page</span></a></p>
</div>

What I'm trying to do is find a way to print this out ONLY if the <span class="alt"> is true.

How would I go about doing this?

I believe that I'm going to have to check the elements by class of this $custom parameter. However, I have no idea how to go about doing this.

  • 写回答

1条回答 默认 最新

  • duanjue6584 2011-12-07 06:27
    关注
    function mytheme_preprocess_block(&$vars) {
      if ($vars['block_id'] === 'target_block_id') {
        // do something for this block
    
      }
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于这个问题的代码运行
  • ¥50 三种调度算法报错 有实例
  • ¥15 关于#python#的问题,请各位专家解答!
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败