2010-12-30 16 views
0

テーブルの行を別のページに表示する方法を理解できません。私がしたいことは、個々の行を印刷可能にします。ここにはscreen shotがあります。アレイの各行を別のページに個別に表示する方法はありますか?

<?php include template("header");?> 

<div id="bdw" class="bdw"> 
<div id="bd" class="cf"> 
<div id="coupons"> 
<div class="dashboard" id="dashboard"> 
<ul><?php echo current_account('/coupon/index.php'); ?></ul> 
</div> 
<div id="content" class="coupons-box clear"> 
<div class="box clear"> 
<div class="box-top"></div> 
<div class="box-content"> 
<div class="head"> 
<h2>My <?php echo $INI['system']['couponname']; ?></h2> 
<ul class="filter"> 
<li class="label">Category: </li> 
<?php echo current_coupon_sub('index'); ?> 

</ul> 
</div> 
<div class="sect"> 
<?php if($selector=='index'&&!$coupons){?> 
<div class="notice">There is no usable <?php echo $INI['system']['couponname']; ?></div> 
<?php }?> 
<table id="orders-list" cellspacing="0" cellpadding="0" border="0" class="coupons-table"> 
<tr><th width="300">Deal Item</th><th width="100" nowrap>Voucher's Number</th><th width="60" nowrap>Voucher's Password</th><th width="100" nowrap>Valid Till</th><th width="40">Email Voucher</th></tr> 
<?php if(is_array($coupons)){foreach($coupons AS $index=>$one) { ?> 
<tr <?php echo $index%2?'':'class="alt"'; ?>> 
<td><a class="deal-title" href="/team.php?id=<?php echo $one['team_id']; ?>" target="_blank"><?php echo $teams[$one['team_id']]['title']; ?></a></td> 
<td><?php echo $two['id']; ?></td> 
<td><?php echo $two['secret']; ?></td> 
<td><?php echo date('Y-m-d', $two['expire_time']); ?></td> 
<td><a href="/coupon/print.php">Send</a></td> 
</tr> 
<?php }}?> 
<tr><td colspan="5"><?php echo $pagestring; ?></td></tr> 
</table> 
</div> 
</div> 
<div class="box-bottom"></div> 
</div> 
</div> 
<div id="sidebar"> 

</div> 
</div> 
</div> <!-- bd end --> 
</div> <!-- bdw end --> 

<?php include template("footer");?> 

より(index.phpを):ここ

テーブル(coupon_index.php)を表示するために使用されるPHPでここ

<?php 
require_once(dirname(dirname(__FILE__)) . '/app.php'); 

need_login(); 
$daytime = strtotime(date('Y-m-d')); 
$condition = array(
'user_id' => $login_user_id, 
'consume' => 'N', 
"expire_time >= {$daytime}", 
); 

$count = Table::Count('coupon', $condition); 
list($pagesize, $offset, $pagestring) = pagestring($count, 10); 
$coupons = DB::LimitQuery('coupon', array(
'condition' => $condition, 
'coupon' => 'ORDER BY create_time DESC', 
'size' => $pagesize, 
'offset' => $offset, 
)); 

$team_ids = Utility::GetColumn($coupons, 'team_id'); 
$teams = Table::Fetch('team', $team_ids); 

include template('coupon_index'); 

は、HTML(coupon_index.html)であります:

<!--{include header}--> 

<div id="bdw" class="bdw"> 
<div id="bd" class="cf"> 
<div id="coupons"> 
    <div class="dashboard" id="dashboard"> 
     <ul>${current_account('/coupon/index.php')}</ul> 
    </div> 
    <div id="content" class="coupons-box clear"> 
     <div class="box clear"> 
      <div class="box-top"></div> 
      <div class="box-content"> 
       <div class="head"> 
        <h2>My {$INI['system']['couponname']}</h2> 
        <ul class="filter"> 
         <li class="label">Category: </li> 
         ${current_coupon_sub('index')} 

        </ul> 
       </div> 
       <div class="sect"> 
        <!--{if $selector=='index'&&!$coupons}--> 
        <div class="notice">There is no usable {$INI['system']['couponname']}</div> 
        <!--{/if}--> 
        <table id="orders-list" cellspacing="0" cellpadding="0" border="0" class="coupons-table"> 
        <tr><th width="300">Deal Item</th><th width="100" nowrap>Voucher's Number</th><th width="60" nowrap>Voucher's Password</th><th width="100" nowrap>Valid Till</th><th width="40">Print Voucher</th></tr> 
        <!--{loop $coupons $index $one}--> 
         <tr ${$index%2?'':'class="alt"'}> 
          <td><a class="deal-title" href="/team.php?id={$one['team_id']}" target="_blank">{$teams[$one['team_id']]['title']}</a></td> 
          <td>{$one['id']}</td> 
          <td>{$one['secret']}</td> 
          <td>${date('Y-m-d', $one['expire_time'])}</td> 
          <td></td> 
         </tr> 
        <!--{/loop}--> 
         <tr><td colspan="5">{$pagestring}</td></tr> 
        </table> 
       </div> 
      </div> 
      <div class="box-bottom"></div> 
     </div> 
    </div> 
    <div id="sidebar"> 

    </div> 
</div> 
</div> <!-- bd end --> 
</div> <!-- bdw end --> 

<!--{include footer}--> 

答えて

0

印刷ページあたりの行がページブレーク前またはページ・ブレークの後を使用するだけであり、出力する最も簡単な解決策CSSプロパティ。つまり、あなたが選択したルートに応じて、最初または最後のいずれかでこれらを抑圧する必要があります。

例えば:

<style> 
@media print { 
    table tr {page-break-after:always} 
} 
</style> 
0

あなたは、問題のクーポンのデータベースのROWID、またはそれらのいくつかのバリエーションを渡す必要があります。私は多分それのMD5、それはセッションの人がそのクーポンの所有者でクーポンが有効であるという遠方のチェックと一緒に使用します...

あなたの印刷リンクは:

<td><a href="/coupon/print.php{md5($one['id'])}">Send</a></td> 
+0

あなたは "?php"の後に "?hash ="を入れたいでしょうか? –

0

coupon_index.php私は$ 2のことを理解できません。 このコードを適切に名前を付けてインデントする必要があります。表示する行の適切なIDを見つけ、適切なコントローラにこの情報を渡します。このコントローラは、関連する行のみをロードします。

関連する問題