0

所以我想这对你们大多数人来说很容易,但我无法弄清楚。

我试图使链接动态,例如:href="linkname(#1 or #2 etc)"

有任何想法吗?

 <?php if ($top_fundraisers && is_array($top_fundraisers)): ?>
        <?php foreach ($top_fundraisers as $index => $fundraiser): ?>
           <a title="" class="fancybox" href="linkname(GENERATE CODE HERE)">
        <div class="top-fundraiser">

            <div id="newo<?php print htmlentities($index + 1); ?>" class="top-fundraiser-image">
              <img src="<?php
          if($fundraiser['member_pic_medium']) {
                  print htmlentities($fundraiser['member_pic_medium']);
          } else {
            print $template_dir . '/images/portrait_placeholder.png';
          }
              ?>"/>
            </div>
    </div>
    </a>
        <?php endforeach;?>
    <?php endif; ?>
4

1 回答 1

0

假设下面是您需要的。

 <?php if ($top_fundraisers && is_array($top_fundraisers)): ?>
        <?php foreach ($top_fundraisers as $index => $fundraiser): ?>
           <a title="" class="fancybox" href="linkname(#<?php echo $index + 1; ?>)">
        <div class="top-fundraiser">

            <div id="newo<?php print htmlentities($index + 1); ?>" class="top-fundraiser-image">
              <img src="<?php
          if($fundraiser['member_pic_medium']) {
                  print htmlentities($fundraiser['member_pic_medium']);
          } else {
            print $template_dir . '/images/portrait_placeholder.png';
          }
              ?>"/>
            </div>
    </div>
    </a>
        <?php endforeach;?>
    <?php endif; ?>
于 2012-09-27T05:37:21.547 回答