[TYPO3-mvc] How do you get the "next" record when on a detail view?

Stephen Bungert stephenbungert at yahoo.de
Sat Jan 28 16:19:45 CET 2012


Ok. Thanks.

Your previous function works, but on the last item it shows the first item 
(not sure if you know about this already.

In order to show the previous item when viewing the last item I had to add 
the following to the previous functions query:

->setOrderings(array('uid' => 
Tx_Extbase_Persistence_QueryInterface::ORDER_DESCENDING))

to the function.


"Alexander Dick" <typo3 at dick.at> schrieb im Newsbeitrag 
news:mailman.1.1327761261.9461.typo3-project-typo3v4mvc at lists.typo3.org...
> Sometimes you cant't print objects because they are too big. The blank 
> page possibly comes from your server's exhausted memory.
>
> It's not the data of your item but there are many other objects attached 
> to it, and even some recursion is going on.
>
> kind regards
> Alex
>
> Am 28.01.2012 11:30, schrieb Stephen Bungert:
>> Thanks, it works, i can ouput the next record in my template
>>
>> {next.title} show the correct title, so I know it has found the correct
>> record.
>>
>> But if I try and debug the next record in fluid or in my controller the
>> output from typo3 is a blank page.
>>
>> Can you debug your next item in your fluid template ok?
>>
>> "Alexander Dick" <typo3 at dick.at> schrieb im Newsbeitrag
>> news:mailman.1.1327739758.21075.typo3-project-typo3v4mvc at lists.typo3.org...
>>>
>>> Hi,
>>>
>>> I made it this way:
>>>
>>> /**
>>> * Finds the previous of the given item
>>> *
>>> * @param Tx_Xxx_Domain_Model_Card $card The reference card
>>> * @return Tx_Xxx_Domain_Model_Card
>>> */
>>> public function findPrevious(Tx_Xxx_Domain_Model_Card $card) {
>>> $query = $this->createQuery();
>>> $cards = $query->matching($query->lessThan('uid', $card->getUid()))
>>> ->setLimit(1)
>>> ->execute();
>>> return (count($cards) == 0) ? NULL : $cards->getFirst();
>>> }
>>>
>>> /**
>>> * Finds the card next to the given card
>>> *
>>> * @param Tx_Xxx_Domain_Model_Card $card The reference card
>>> * @return Tx_Xxx_Domain_Model_Card
>>> */
>>> public function findNext(Tx_Xxx_Domain_Model_Card $card) {
>>> $query = $this->createQuery();
>>> $cards = $query->matching($query->greaterThan('uid', $card->getUid()))
>>> ->setLimit(1)
>>> ->execute();
>>> return (count($cards) == 0) ? NULL : $cards->getFirst();
>>> }
>>>
>>> HTH
>>> kind regards
>>> Alex
>>>
>>> Am 27.01.2012 20:47, schrieb Stephen Bungert:
>>>> I have a function in my repository:
>>>>
>>>> /**
>>>> * Finds the single view's item's next item
>>>> *
>>>> * @param integer $uid The uid of the current single item.
>>>> * @return mixed An item
>>>> */
>>>> public function findNext($uid) {
>>>> $query = $this->createQuery();
>>>> $query->matching($query->greaterThan('uid', $uid));
>>>> return $query->execute();
>>>> }
>>>>
>>>> That I call in my detail action in my controller.
>>>>
>>>> $uid is the uid of the detail record, but trying to debug the return of
>>>> this function causes TYPO3 to not output anything.
>>>>
>>>> I tried looking at other extbase extensions like news and blogexample
>>>> but I couldn't see any examples of how to get next records.
>>>>
>>>>
>>>> Thanks for any help.
>>>>
>>>> Stephen.
>> 



More information about the TYPO3-project-typo3v4mvc mailing list