i have two models binded with section model this two models called (gallery,article),i want to paginate all this in 概览.ctp.so i have two problems
1-when put $id in $paginate to retrieve articles by section $id i get parse error
2-how to separate between the two paginations (gallery,article) in view file ..
var $paginate = array(
Article =>array(
limit => 1,
page => 1,
parse error here//
conditions => array( section_id =>$id)
),
Gallery =>array(
limit => 3,
page => 1,
conditions => array( section_id =>86))
)
;
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__( Invalid gallery , true));
$this->redirect(array( action => index ));
}
$gallery = $this->paginate( Gallery );
// find Articles at sections
$articles = $this->paginate( Article );
$section = $this->Section->findById($id);
// set the section for the view
$this->set(compact( articles , gallery , section ));
}
概览
<div class="related">
<table>
<tbody>
<h3> section is <?php echo $section [ Section ][ name ]; ?></h3>
<br />
<?php foreach($articles as $article): ?>
<tr>
<td><?php if($article[ Article ][ status ]== 1){echo $article[ Article ][ title ];} ?></td>
<td><?php if($article[ Article ][ status ]== 1){echo .$html->link( View , /articles/view/ .$article[ Article ][ id ]);}?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php if($section[ Section ][ id ]==86): ?>
<div class="related">
<table>
<tbody>
<?php foreach($gallery as $galler): ?>
<tr>
<td> <?php echo .$html->link($galler[ Gallery ][ name ], /galleries/view/ .$galler[ Gallery ][ id ]);?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<p>
<?php
echo $this->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="paging">
<?php echo $this->Paginator->prev( << . __( previous , true), array(), null, array( class => disabled ));?>
| <?php echo $this->Paginator->numbers();?>
|
<?php echo $this->Paginator->next(__( next , true) . >> , array(), null, array( class => disabled ));?>
</div>
<?php endif ; ?>