i have the object book with its attribute visible as boolean. i wanna
use pagination and it works except for one thing.
first i did two "this->paginate" in my controller. one with visible
condition true and the other with false. but cake doesnt like two
paginations in one controller.
so i just returned any book, that a user "follows", no matter if it is
set to visible true or false.
controller:
public $paginate = array('Book' => array('limit' => 1, 'joins' =>
array(
array(
'table' => 'books_users',
'alias' => 'BookUser',
'conditions'=> array('BookUser.fk_book_id = Book.id AND
Book.locked = false')
)
)));
NOW in my view, i want to make the distinction. when the user is
visiting his own profile, non visible books are listed, since these
are his own. if someone visits a another profile, the non visible
books shall not appear.
view:
if ($user['User']['username'] == $this->Session->read('User.username'))
{
if ($private_books['BookUser']['BooksUser']['visible'] = 'true')
.......show
else
.......dont show
Problem: i cant access the visible field from the pagination array,
that looks like that
[BookUser] => Array
(
[0] => Array
(
[firstname] => test
[lastname] => user
[username] => testuser
[BooksUser] => Array
(
>>>>>>>>>>>>>> [visible] => 1
<<<<<<<<<<<<<<<<<<
)
)
)
}
so how can i access the visible here? I tried
if ($private_books['BookUser']['BooksUser']['visible'] = 1)
but it didnt work....
thanks :)
--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment