0

我有以下动作:

    public function admin_website_status($id = null){
    $i = 0;

    $this->Paginator->settings = array(
        'Website' => array(
        )
    );
    $this->set('websites',$this->Paginator->paginate('Website'));
}

现在我想向这个动作发送一个值,所以在我看来,我有以下链接:

<?php echo $this->Html->link(__('Active'), array('action' => 'website_status', $website['Website']['website_id'])); ?>

当我调试时,即使我知道该值应该是,也不会发送任何值1

那我做错了什么?

我的全景

<div class="portlet box red">
<div class="portlet-title">
    <div class="caption"><i class="icon-globe"></i>Website Status</div>
</div>
<div class="portlet-body">
    <table class="table table-striped table-bordered table-hover table-full-width" id="sample_1">
        <thead>
        <tr>
            <th><?php echo $this->Paginator->sort('Website.domain', 'Website domain');?></th>
            <th><?php echo $this->Paginator->sort('Website.client_id', 'Affiliate ID');?></th>
            <th><?php echo $this->Paginator->sort('User.username', 'E-mail Address');?></th>
            <th><?php echo $this->Paginator->sort('Status.status', 'Status'); ?> </th>
            <th class="actions"><?php echo __('Actions'); ?></th>

        </tr>
        </thead>
        <?php foreach ($websites as $site): ?>
            <tr>
                <td><?php echo $site['Website']['domain']; ?></td>
                <td><?php echo $site['Client']['client_id'];?></td>
                <td><?php echo $site['Client']['user_id'];?></td>
                <td><?php echo $site['Status']['Status']; ?></td>
                <td class="actions">
                    <?php echo $this->Html->link(__('Active'), array('action' => 'website_status', $website['Website']['website_id'])); ?>
                </td>
            </tr>
        <?php endforeach; ?>
    </table>
    <div class="paging">
        <?php
        echo $this->Paginator->prev('« Previous', null, null, array('class' => 'disabled'));
        echo $this->Paginator->next('Next »', null, null, array('class' => 'disabled'));
        ?>
    </div>

</div>

4

2 回答 2

1
$websites['Website']['website_id']

并不是

$website['Website']['website_id']

(复数而不是单数)

编辑:看到你的整个代码后

$site['Website']['website_id']
于 2013-10-04T08:48:28.373 回答
1

$this->Html->link你的设置'action' => 'website_status' 中它应该是 admin_website_status 吗?

还要确保$website['Website']['website_id']有价值。也许它是空的。

于 2013-10-04T08:49:08.080 回答