On Mon, Jun 1, 2009 at 12:06 AM, [email protected]
<[email protected]> wrote:
>
> Hi:
>    I need somebody to help fix a problem of duplicate (even
> triplicate) rows for the same record (with same unique ID) from my
> table - in my cakephp view displays.
>
> I know the problem is definitely coming from Cake because I can
> confirm that the mysql tables don't have the repeated records. Could
> it be a pagination bug that I don't know of? here's the code from my
> 'index' controller and view:
>
> FROM index CONTROLLER:
> -----------------------------
> function index() {
>                $this->Jurisdiction->recursive = 0;
>                $this->set('jurisdictions', $this->paginate());
>        }
>
>
> FROM index VIEW
> -----------------------------
> <div class="jurisdictions index">
> <h2><?php __('Jurisdictions');?></h2>
> <p>
> <?php
> echo $paginator->counter(array(
> 'format' => __('Page %page% of %pages%, showing %current% records out
> of %count% total, starting on record %start%, ending on %end%', true)
> ));
> ?></p>
> <div class="actions">
>        <ul>
>                <li><?php echo $html->link(__('New Jurisdiction', true), array
> ('action'=>'add')); ?></li>
>        </ul>
> </div>
> <table cellpadding="0" cellspacing="0">
> <tr>
>        <th><?php echo $paginator->sort('id');?></th>
>        <th><?php echo $paginator->sort('name');?></th>
>        <th><?php echo $paginator->sort('city');?></th>
>        <th><?php echo $paginator->sort('region');?></th>
>        <th><?php echo $paginator->sort('description');?></th>
>        <th><?php echo $paginator->sort('auth_level');?></th>
>        <th><?php echo $paginator->sort('contact_id');?></th>
>        <th class="actions"><?php __('Actions');?></th>
> </tr>
> <?php
> $i = 0;
> foreach ($jurisdictions as $jurisdiction):
>        $class = null;
>        $class = ( ($i % 2) ? " class='altrow'": '' );
>        $i++;
>        //if ($i++ % 2 == 0) {
>        //      $class = ' class="altrow"';
>        //}
> ?>
>

You haven't included the code where the rows are output.

OT: when I want to create a table with alternating rows, I usually do
it like so:

$i = 2;

foreach($whatever as $something)
{
?>
<tr class="Row_<?= ++$i % 2 ?>">

And I have CSS classes Row_0 & Row_1.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to