如何正确输出此表?

时间:2017-02-02 21:36:44

标签: php css archive

此代码输出左侧的图像,我正在寻找的是右侧的图像:https://s27.postimg.org/niua66jqr/archive.jpg 如何正确输出此表?这是归档代码或样式代码的问题吗?

<div class="archive-container">

  <h2><?php the_title(); ?></h2>

  <script type="text/javascript">
    var domainroot = "sitetitle.com"

    function Gsitesearch(curobj) {
      curobj.q.value = "site:" + domainroot + " " + curobj.qfront.value
    }
  </script>


  <form action="http://www.google.com/search" method="get" onSubmit="Gsitesearch(this)">

    <p class="search">Search:
      <br />
      <input name="q" type="hidden" class="texta" />
      <input name="qfront" type="text" style="width: 186px; text-size: 12px; height: 14px;" />
    </p>

  </form>


  <table id=arc>
    <?php $query="SELECT YEAR(post_date) AS `year`, MONTH(post_date) as `month`, DAYOFMONTH(post_date) as `dayofmonth`, ID, post_name, post_title FROM $wpdb->posts WHERE post_type = 'article' AND post_status = 'publish' ORDER BY post_date DESC" ; $key=m d5($query);
    $cache=w p_cache_get( 'mp_archives' , 'general'); if ( !isset( $cache[ $key ] ) ) { $arcresults=$ wpdb->get_results($query); $cache[ $key ] = $arcresults; wp_cache_add( 'mp_archives', $cache, 'general' ); } else { $arcresults = $cache[ $key ]; } if ($arcresults) { $last_year = 0; $last_month = 0; foreach ( $arcresults as $arcresult ) { $year = $arcresult->year;
    $month = $arcresult->month; if ($year != $last_year) { $last_year = $year; $last_month = 0; ?>
    <tr class=year>
      <th>
        <br />
        <br />
        <?php echo $arcresult->year; ?></th>
    </tr>
    <?php } if ($month !=$ last_month) { $last_month=$ month; ?>
    <tr class=archive>
      <th>
        <?php echo $wp_locale->get_month($arcresult->month); ?></th>
      <td></td>
    </tr>
    <?php } ?>
    <tr class=archive>
      <th>
        <?php echo $arcresult->dayofmonth; ?></th>
      <td id=p<?php echo $arcresult->ID; ?>>
        <a href="/<?php echo $arcresult->post_name; ?>">
          <?php echo strip_tags(apply_filters( 'the_title', $arcresult->post_title)); ?></a>
      </td>
    </tr>
    <?php } } ?>
  </table>
</div>
<!-- /end .container -->
{{1}}

1 个答案:

答案 0 :(得分:0)

也许:

    <table width="200" border="1">
  <tbody>
    <tr>
      <td>
      <div>2017</div>
      <div>Januari</div>
      <div>1</div>
      </td>
      <td>Long title here</td>
    </tr>
        <tr>
      <td>
      <div>2016</div>
      <div>Januari</div>
      <div>1</div>
      </td>
      <td>Long title here</td>
    </tr>
  </tbody>
</table>